Very good question. If I were at a dead end, so I dived into the rails source and picked up database.rake . Now this is more clear:
db:test:clone is just a combination of db:schema:dump and db:test:load :
task :clone => %w(db:schema:dump db:test:load)
db:test:clone_structure uses the file {rails_env} _structure.sql:
task :clone_structure => [ 'db:structure:dump', 'db:test:purge' ] do
db:test:load same as db:schema:load , but calls it in the test database:
task :load => 'db:test:purge' do ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
db:test:prepare warns you if any migrations are expected, and if not, either runs db:test:clone_structure (using the file {rails_env} _structure.sql), or db:test:load (using the schema.rb file) , depending on (this is a bit confusing to me, maybe someone can expand on it):
task :prepare => 'db:abort_if_pending_migrations' do
Hope this clears up! Again, going through the database.rake file is simple and will clear up any other issues that you may have. This link refers to the line that is the start of the namespace: test.
bricker Oct 07 '11 at 23:18 2011-10-07 23:18
source share