Reputation: 5178
I am trying to implement testing and realized I need to create a testing database.
schema.rb
file from the database by running rake db:schema:dump
.Now what I need to do (I think) is do something like a rake db:schema:load
, but I want to specify that I am doing this for the test database (not the development database or the production database. I don't want to delete any of the data there!)
I attempted rake db:test:schema:load
but that was not working.
Searches online advise using commands that appear to be deprecated for rails 4.1 or later.
RAILS_ENV=test rake db:schema:load
Upvotes: 1
Views: 344
Reputation: 364
If you want to specify that you are creating the "test" database:
RAILS_ENV=test rake db:create
The RAILS_ENV environmental variable will allow you to specify which environment you wish to use. These environments will be defined in your "config/database.yml". Ensure that you have a test environment setup and a database specified under it. This can be done to any task that you would like to affect a particular environment.
RAILS_ENV=test rake any:task:here
Upvotes: 1