frab/frab — pull request #50 by tias (2013-06-02 21:25:39+00:00)
Title: Bug migrate

The first 3 commits are also part of pull request #49

One more is added here, because a
rake db:setup
rake db:migrate VERSION=20110930110209

works after #49

but then doing a rake db:migrate

Fails with:
SQLite3::SQLException: no such table: ordered_products: DROP TABLE "ordered_prod
ucts"
/var/lib/gems/1.9.1/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `initialize
'
/var/lib/gems/1.9.1/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `new'
/var/lib/gems/1.9.1/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `prepare'
/var/lib/gems/1.9.1/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:134:in `execute'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:278:in `block in execute'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/abstract_adapter.rb:280:in `block in log'
/var/lib/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/i
nstrumenter.rb:20:in `instrument'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/abstract_adapter.rb:275:in `log'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:278:in `execute'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/abstract/schema_statements.rb:256:in `drop_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/migration.rb:466:
in `block in method_missing'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/migration.rb:438:in `block in say_with_time'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/migration.rb:438:in `say_with_time'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/migration.rb:458:in `method_missing'
/srv/frab/db/migrate/20120920213816_remove_products.rb:3:in `up'
...

The real problem is in migrate/20120920213816_remove_products.rb, where no 'down' is defined.

Patch "Migrate remove_products: no down defined" adds the missing create_table statements