I have been [trying] to use migrations with UNIX timestamps, so multiple developers can add migrations without tipping on each others toe.
And hence I tried this:
It works, at least rake db:migrate. but other rake commands that deal with database is broken and hence rake db:test:prepare or rake test:units.
I ran above commands with --trace enabled and I found some curious things:
gnufied@xaos:~/simple_markets$ rake db:migrate --trace /usr/local/bin/rake:17:Warning: require_gem is obsolete. Use gem instead. (in /home/gnufied/simple_markets) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment "Hello World" #=> init.rb of enhanced migrations plugin called. ** Execute db:migrate == Alerts: migrating ========================================================== -- create_table(:alerts) -> 0.0629s == Alerts: migrated (0.0632s) =================================================
== Devices: migrating ========================================================= -- create_table(:devices) -> 0.0095s == Devices: migrated (0.0100s) ================================================
** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump
Now, lets see the flow when I run rake db:test:prepare:
gnufied@xaos:~/simple_markets$ rake db:test:prepare --trace /usr/local/bin/rake:17:Warning: require_gem is obsolete. Use gem instead. (in /home/gnufied/simple_markets) ** Invoke db:test:prepare (first_time) ** Invoke environment (first_time) ** Execute environment "Hello World" ** Execute db:test:prepare ** Invoke db:test:clone (first_time) ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:clone ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load rake aborted! Mysql::Error: Table 'simple_markets_test.schema_info' doesn't exist: SHOW FIELDS FROM schema_info ** All Hell broke loose here.
So, in a nutshell, enhanced migrations plugin has deleted schema_info table and uses migrations_info table. But above trace makes me wonder, why db:test:clone and couple of other tasks are being invoked more the once?
I don't have a definite solution to the problem, and so i ask.