From 11d3c065a5b71caa66f64d22e08f31eba0c357c5 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 2 Jun 2021 19:15:17 +0200 Subject: Fix migration script not being able to run if it fails midway (#16312) * Fix migration script not being able to run if it fails midway * Fix old migration script * Fix old migration script * Refactor CorruptionError --- lib/mastodon/migration_helpers.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/mastodon/migration_helpers.rb b/lib/mastodon/migration_helpers.rb index 521d903bf..39a6e0680 100644 --- a/lib/mastodon/migration_helpers.rb +++ b/lib/mastodon/migration_helpers.rb @@ -41,6 +41,20 @@ module Mastodon module MigrationHelpers + class CorruptionError < StandardError + def initialize(message = nil) + super(message.presence || 'Migration failed because of index corruption, see https://docs.joinmastodon.org/admin/troubleshooting/index-corruption/#fixing') + end + + def cause + nil + end + + def backtrace + [] + end + end + # Model that can be used for querying permissions of a SQL user. class Grant < ActiveRecord::Base self.table_name = 'information_schema.role_table_grants' -- cgit