Skip to content

Commit

Permalink
Fix current data version lookup in db:migrate:with_data
Browse files Browse the repository at this point in the history
This is a re-creation of ilyakatz#202, which fixes a bug where the AR migration schema version is incorrectly referenced instead of the data migration version.

This causes data migrations be to be incorrectly re-run on an otherwise migrated database whenever the most recent schema version is lower than the most recent data version.
  • Loading branch information
reidab authored Dec 13, 2022
1 parent 19897f5 commit 1b951b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/databases.rake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace :db do
[]
end

current_data_version = ActiveRecord::Migrator.current_version
current_data_version = DataMigrate::DataMigrator.current_version
data_migrations = if target_version > current_data_version
DataMigrate::DatabaseTasks.pending_data_migrations.keep_if{ |m| m[:version] <= target_version }.map{ |m| m.merge(:direction =>:up) }
elsif target_version < current_data_version
Expand Down

0 comments on commit 1b951b1

Please sign in to comment.