On Sep 7, 2008, at 5:58 AM, Jon Leighton wrote:
>
> Apologies if this is blatantly obvious and I am wasting your time -
> I'm quite an infrequent Rails contributor...
>
> Basically I am looking for an easy way to load the schema definitions
> from activerecord/test/schema into my databases. In the
> RUNNING_UNIT_TESTS file it says "When you have the database online,
> you can import the fixture tables with the test/schema/*.sql files."
> This seems to be outdated as all the files in test/schema are now .rb
> schema files.
>
> I can't see a rake task to perform this - maybe there should be one?
>
> I'd be happy to create a patch to make this a bit easier for others in
> the future.
If you run the whole test suite via rake test_mysql, it happens
automatically using a dirty trick. If you want to do it manually, you
need to run the file aaa_create_tables_test.rb - the 'aaa' forces the
file to run before all the other tests, ensuring the schema is loaded.
In directory rails/activerecord:
$ ruby -Ilib:test:test/connections/native_mysql test/cases/
aaa_create_tables_test.rb
Using native MySQL
Loaded suite test/cases/aaa_create_tables_test
Started
.-- adapter_name()
-> 0.0000s
-- create_table(:accounts, {:force=>true})
-> 0.0076s
# lots of lines omitted...
-- create_table(:binary_fields, {:options=>"CHARACTER SET
latin1", :force=>true})
-> 0.0074s
.
Finished in 1.067615 seconds.
2 tests, 2 assertions, 0 failures, 0 errors
If you use some other db than mysql, just change the -I option to use
the correct connection file.
RUNNING_UNIT_TESTS needs updating. I was going to do that at one
point but got distracted. If you have time to do a doc patch, I'll +1
it :-)
--
Josh Susser
http://blog.hasmanythrough.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---