Skip to content

Commit

Permalink
Remove old duplicate index (mastodon#17245)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ClearlyClaire authored and jesseplusplus committed Feb 10, 2022
1 parent 8fa2c04 commit 764bf99
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions db/migrate/20220105163928_remove_mentions_status_id_index.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class RemoveMentionsStatusIdIndex < ActiveRecord::Migration[6.1]
def up
remove_index :mentions, name: :mentions_status_id_index if index_exists?(:mentions, :status_id, name: :mentions_status_id_index)
end

def down
# As this index should not exist and is a duplicate of another index, do not re-create it
end
end

0 comments on commit 764bf99

Please sign in to comment.