Explore
Topics
Recent Comments
- I had checked, and tested a lot of time. It work well and flexible on IE, FF, and Chrome *But, in Chrome...
Phong Tran
- hi! i am working with cascades and i would like to use a hands detector and apply a kalman filter to follow...
rachel
- Hi Cary, Cool work, I would like to get the XML file and codes can you email to me please at sheryzo@gmail.com....
Sha
- I had checked, and tested a lot of time. It work well and flexible on IE, FF, and Chrome *But, in Chrome...
Related Posts
Amazon Web ServicesELC is one of the few groups in the world who can help you build highly scalable businesses on Amazon's low-cost Web Services platform.
Migrate Test DB Rake Plugin
MigrateTestDB plugin was created to allow migrations to be used to generate the test database in rake test commands. This is helpful for consistently testing migrations, but was absolutely necessary for the following use case we encountered:
Using VIEWS or STORED PROCEDURES. We were using a legacy database (a legacy MS SQL server for production, MySQL 5 for development and tests). Neither schema format (:ruby or :sql) plays nicely when exporting the schema for the database. They do not output the VIEWS nor STORED PROCEDURES so all of our tests requiring this functionality failed.
MigrateTestDB deletes Rails’ default test:db:prepare task which only supports schema_format = :sql and schema_format = :ruby. The replacement task works identically (as of Rails 1.2.3) to Rails default task; however, specifying a schema_format = :migrate will cause a new preparation task to run within the plugin. The task runs migration scripts to ready the test database. The plugin leverages the existing rake tasks for purging the test database, and loading the migration scripts–so the plugin code is mainly a reglue of exisiting Rails default functionality.
This code was originally developed as a patch for railsties/lib/rake/databases.rake. The patch was developed by Andre Price under the direction of Jonathan Siegel at ELC Technologies. It was submitted for inclusion to Rails core and received the response:
http://dev.rubyonrails.org/ticket/4814#comment:1> “This is a great idea for a plugin. If you release it and most Rails developers begin using it then it might be a good candidate for core. Until then I’m going to close this ticket.”
The patch was converted to a plugin by Jonathan Siegel.
Usage
1. Install the plugin:
./script/plugin install http://svn.elctech.com/svn/public/plugins/migrate_test_dbor with external SVN reference:
./script/plugin install -x http://svn.elctech.com/svn/public/plugins/migrate_test_db2. Edit config/environment.rb:
config.active_record.schema_format = :migrate3. That’s it! The next time you run rake (or any rake task that depends on the test:db:prepare task) you’ll see that your test database is being generated from your migrations. You can confirm that the plugin is active by running:
rake --tasksYou will see a modified db:test:prepare:
rake db:test:prepare # Overwritten standard prepare to include parsing of :migrate schema_format type.