Skip to content

A platform for community discussion. Free, open, simple.

DEV: Drop user_id from chat_mentions (#25022)

Andrei Prigorshnev463eff2bbf43
diff --git a/plugins/chat/app/models/chat/mention.rb b/plugins/chat/app/models/chat/mention.rb
index 7d56191d782..e771852a461 100644
--- a/plugins/chat/app/models/chat/mention.rb
+++ b/plugins/chat/app/models/chat/mention.rb
@@ -19,7 +19,6 @@ end
#
# id :bigint not null, primary key
# chat_message_id :integer not null
-# user_id :integer
# target_id :integer
# type :integer not null
# created_at :datetime not null
diff --git a/plugins/chat/db/post_migrate/20240410130000_drop_user_id_from_chat_mentions.rb b/plugins/chat/db/post_migrate/20240410130000_drop_user_id_from_chat_mentions.rb
new file mode 100644
index 00000000000..d2ca6216f7b
--- /dev/null
+++ b/plugins/chat/db/post_migrate/20240410130000_drop_user_id_from_chat_mentions.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class DropUserIdFromChatMentions < ActiveRecord::Migration[7.0]
+ DROPPED_COLUMNS ||= { chat_mentions: %i[user_id] }
+
+ def up
+ DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end