Undo reverted migrations when needed

This commit is contained in:
Claire 2025-09-08 18:22:52 +02:00
parent bdebc4dc46
commit c4676a83fd
3 changed files with 14 additions and 1 deletions

View File

@ -11,6 +11,8 @@
#
class Conversation < ApplicationRecord
self.ignored_columns += %w(parent_status_id parent_account_id)
validates :uri, uniqueness: true, if: :uri?
has_many :statuses, dependent: nil

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class RemoveRevertedConversationChanges < ActiveRecord::Migration[8.0]
def up
remove_index :statuses, :conversation_id if index_exists?(:statuses, :conversation_id)
safety_assured { remove_column :conversations, :parent_status_id, if_exists: true }
safety_assured { remove_column :conversations, :parent_account_id, if_exists: true }
end
def down; end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_08_20_084312) do
ActiveRecord::Schema[8.0].define(version: 2025_09_08_181205) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"