frab/frab — pull request #49 by tias (2013-06-02 21:21:44+00:00)
Title: Bug migrate down

Doing a migrate down gives errors.

Here is how to reproduce, the error that was returned and my proposal for a fix:

$ rake db:setup
$ rake db:migrate VERSION=20110930110209

undefined method `remove_columnt' for #
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/migration.rb:465: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/20121118034920_private_attachments.rb:11:in `down'
...

Patch "Migrate: fix typo"

Then,
wrong number of arguments (2 for 3)
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:398:in `add_column'
/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/20120806161457_availabilities_belong_to_day.rb:44:in `down'
...

Patch "Migrate: add missing types to 'down' add_column statements"

Then,
undefined method `type=' for nil:NilClass
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:444:in `block (2 levels) in change_column'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:443:in `instance_eval'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:443:in `block in change_column'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:478:in `block in alter_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:512:in `block in copy_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/abstract/schema_statements.rb:160:in `create_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:498:in `copy_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:488:in `move_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:483:in `block in alter_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/abstract/database_statements.rb:192:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:480:in `alter_table'
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapte
rs/sqlite_adapter.rb:441:in `change_column'
/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/20120425121612_change__conference_day_start_type.rb:12:in `down'
...

Real problem is in 'migrate/20120804220617_create_conference_date_conversions.rb' where 'down' is not defined...
I do not know enough ruby to actually fill in meaningful values...

Patch "Migrate: missing 'down' part. Temporary fix: at least add the columns with some value" does the minimalistic thing of at least adding the columns
This should probably be fixed more properly...