is "rake db:test:prepare" support to (a) setup FK constraints & (b) run in my test data migration????

Hi,

Just noting (as I start to use unit tests) that when I issue “rake db:test:prepare” that what I do NOT see in my test database (as I do in development when running “rake db:migrate”):

(a) FK constraints don’t seem to be put in place in my test database. Extract from the migration
def self.up
down
directory = File.join(File.dirname(FILE), “dev_data”)
Fixtures.create_fixtures
(directory, “donations”)
Fixtures.create_fixtures(directory, “donation_events”)
Fixtures.create_fixtures(directory, “comments”)
end

(b) Test Data wasn’t loaded - I had one of my migrations that had test data I was loading. This didn’t seem to get loaded.

Is this expected? Should “rake db:test:prepare” not emulate the same as running “rake db:migrate” in development?

Thanks

Greg

(bump) - i.e. Should “rake db:test:prepare” not emulate the same as running “rake db:migrate” in development? (e.g. creation of same FK constraints)

db:test:prepare runs either db:test:clone, or db:test:clone_structure,
based on whether config.active_record.schema_format is :ruby or :sql.

I assume that clone_structure (i.e. :sql) is least likely to ignore your FKs.

You'll find the code for the db tasks at
<http://dev.rubyonrails.org/browser/trunk/railties/lib/tasks/databases.rake>.

HTH,
Isak