How to run db:migrate for test database in Rails 5?
<p>I created a new rails 5 app with postgresql db and modified the database.yml file. I successfully created both development and test databases, but when running migrations only development db is updated and test db remains intact.</p>

<p>Here's the list of commands i used:</p>

<pre><code>rails db:create                     # Created both development and test
rails db:migrate                    # Migrated only to development
rails db:migrate RAILS_ENV=test     # Does nothing (no error output)
rake db:migrate RAILS_ENV=test      # Same result as above
</code></pre>

<p>My database.yml file:</p>

<pre><code>default: &amp;default
  adapter: postgresql
  encoding: unicode
  pool: &lt;%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %&gt;

development:
  &lt;&lt;: *default
  database: myapp_development
  username: myapp_admin
  password:
  host: localhost
  port: 5432

test:
  &lt;&lt;: *default
  database: myapp_test
  username: myapp_admin
  password:
  host: localhost
  port: 5432
</code></pre>

<p>I also tried adding <code>ActiveRecord::Migration.maintain_test_schema!</code> to <code>test_helper.rb</code> but that didn't work either.</p>

<p>Any suggestions?</p>