mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-11 21:14:56 +00:00
Fix ActiveRecord::Migration.check_pending! failing because of duplicate migrations
This commit is contained in:
parent
3d7fd4a2df
commit
2edf317efc
|
@ -37,4 +37,16 @@ module ActiveRecord
|
||||||
super(direction, migrations, target_version)
|
super(direction, migrations, target_version)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class MigrationContext
|
||||||
|
def needs_migration?
|
||||||
|
# A set of duplicated migrations is considered migrated if at least one of
|
||||||
|
# them is migrated.
|
||||||
|
migrated = get_all_versions
|
||||||
|
migrations.group_by(&:name).each do |name, duplicates|
|
||||||
|
return true unless duplicates.any? { |m| migrated.include?(m.version.to_i) }
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue