title: rake db:migrate and rake db:create both work on test database, not development database
body: <p>I am new to Stack Overflow and Ruby on Rails.  My problem is, when I run the command rake db:create or rake db:migrate, the test database is affected, but the development database is not.</p>
  
  <p>rails (3.2.2)</p>
  
  <p>my database.yml:</p>
  
  <pre><code># Warning: The database defined as "test" will be erased and
  # re-generated from your development database when you run "rake".
  # Do not set this db to the same as development or production.
  test: &amp;test
    adapter: postgresql
    encoding: unicode
    database: ticketee_test
    pool: 5
    username: ticketee
    password: my_password_here
  
  development: 
    adapter: postgresql
    encoding: unicode
    database: ticketee_development
    pool: 5
    username: ticketee
    password: my_password_here
  
  production:
    adapter: postgresql
    encoding: unicode
    database: ticketee_production
    pool: 5
    username: ticketee
    password: my_password_here
  
  cucumber:
    &lt;&lt;: *test
  </code></pre>
  
  <p>Thanks for the suggestion, but I am afraid that isn't the reason.  My RAILS_ENV=development.  When I start the rails server, the server runs the development database. if I run "rails server -e test" then the server uses the test database.  I am still not sure why migrations are running on my test database...</p>
  
  <p>UPDATE:
  Based on a suggestion, I commented out all of the database configurations except development, and now I get an error.  I am running postgresql, I have the gem 'pg' installed. First, my new database.yml:</p>
  
  <pre><code>development:
    adapter: postgresql
    encoding: unicode
    database: ticketee_development
    pool: 5
    username: ticketee
    password: my_password_here
  
  # Warning: The database defined as "test" will be erased and
  # re-generated from your development database when you run "rake".
  # Do not set this db to the same as development or production.
  #test: &amp;test
  #  adapter: postgresql
  #  encoding: unicode
  #  database: ticketee_test
  #  pool: 5
  #  username: ticketee
  #  password: my_password_here
  
  #production:
  #  adapter: postgresql
  #  encoding: unicode
  #  database: ticketee_production
  #  pool: 5
  #  username: ticketee
  #  password: my_password_here
  
  #cucumber:
  #  &lt;&lt;: *test
  </code></pre>
  
  <p>My error message!</p>
  
  <pre><code>Someguys-MacBook-Air:ticketee someguy$ rake db:migrate
  rake aborted!
  database configuration does not specify adapter
  
  Tasks: TOP =&gt; db:migrate =&gt; db:load_config
  (See full trace by running task with --trace)
  Someguys-MacBook-Air:ticketee someguy$ rake db:migrate -t
  ** Invoke db:migrate (first_time)
  ** Invoke environment (first_time)
  ** Execute environment
  ** Invoke db:load_config (first_time)
  ** Invoke rails_env (first_time)
  ** Execute rails_env
  ** Execute db:load_config
  rake aborted!
  database configuration does not specify adapter
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in `resolve_hash_connection'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:23:in `spec'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:127:in `establish_connection'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/railtie.rb:76:in `block (2 levels) in &lt;class:Railtie&gt;'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:42:in `each'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/base.rb:718:in `&lt;top (required)&gt;'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/activerecord-3.2.2/lib/active_record/railties/databases.rake:6:in `block (2 levels) in &lt;top (required)&gt;'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
  /Users/someguy/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
  /Users/someguy/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/gems/rake-0.9.2.2/bin/rake:33:in `&lt;top (required)&gt;'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/bin/rake:19:in `load'
  /Users/someguy/.rvm/gems/ruby-1.9.3-p125@defaultGems/bin/rake:19:in `&lt;main&gt;'
  </code></pre>
  
  <p>Using the database.yml above, rake db:create:all RAN CORRECTLY and created my table.  However, my migration still fails with the same stack trace as the one above.  </p>
  
  <p>I changed my database.yml to this:
      development:
        adapter: sqlite3
        database: db/development.sqlite3
        pool: 5
        timeout: 5000</p>
  
  <pre><code>test:
    adapter: sqlite3
    database: db/test.sqlite3
    pool: 5
    timeout: 5000
  
  production:
    adapter: sqlite3
    database: db/production.sqlite3
    pool: 5
    timeout: 5000
  </code></pre>
  
  <p>UPDATE: I completely changed my database.yml to this:</p>
  
  <pre><code>development:
    adapter: sqlite3
    database: db/development.sqlite3
    pool: 5
    timeout: 5000
  
  test: &amp;test
    adapter: sqlite3
    database: db/test.sqlite3
    pool: 5
    timeout: 5000
  
  production:
    adapter: sqlite3
    database: db/production.sqlite3
    pool: 5
    timeout: 5000
  
  cucumber:
    &lt;&lt;: *test
  </code></pre>
  
  <p>Now, this is what happens when I run rake db:drop:all, followed by rake db:migrate.  The rake db:migrate command runs a migration, creating a db/test.sqlite3 AND adding a table to it.  So, my migration is still running on the test environment.  When I run rake environment RAILS_ENV=development db:migrate, the same thing happens and I get a test.sqlite3 file...</p>