diff --git a/lib/data_migrate/database_tasks.rb b/lib/data_migrate/database_tasks.rb index 94f6c15f..42e74b92 100644 --- a/lib/data_migrate/database_tasks.rb +++ b/lib/data_migrate/database_tasks.rb @@ -69,6 +69,8 @@ def data_migrations_path end def run_migration(migration, direction) + ActiveRecord::Base.descendants.each(&:reset_column_information) + if migration[:kind] == :data ::ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71]) ::DataMigrate::DataMigrator.run(direction, data_migrations_path, migration[:version]) @@ -92,6 +94,8 @@ def self.forward(step = 1) DataMigrate::DataMigrator.assure_data_schema_table migrations = pending_migrations.reverse.pop(step).reverse migrations.each do | pending_migration | + ActiveRecord::Base.descendants.each(&:reset_column_information) + if pending_migration[:kind] == :data ActiveRecord::Migration.write("== %s %s" % ["Data", "=" * 71]) DataMigrate::DataMigrator.run(:up, data_migrations_path, pending_migration[:version])