Skip to content

Commit 764bf99

Browse files
ClearlyClairejesseplusplus
authored andcommitted
Remove old duplicate index (mastodon#17245)
Some Mastodon versions (v1.1 and v1.2) had a duplicate index in `db/schema.rb` without any migration script creating it. mastodon#2224 (included in v1.3) removed the duplicate index from the file but did not provide a migration script to remove it. This means that any instance that was installed from v1.1 or v1.2's source code has a duplicate index and a corresponding warning in PgHero. Instances set up using an earlier or later Mastodon version do not have this issue. This PR removes the duplicate index if it is present.
1 parent 8fa2c04 commit 764bf99

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class RemoveMentionsStatusIdIndex < ActiveRecord::Migration[6.1]
2+
def up
3+
remove_index :mentions, name: :mentions_status_id_index if index_exists?(:mentions, :status_id, name: :mentions_status_id_index)
4+
end
5+
6+
def down
7+
# As this index should not exist and is a duplicate of another index, do not re-create it
8+
end
9+
end

0 commit comments

Comments
 (0)