Skip to content

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

DEV: Fix mismatched column types (#29477)

Bianca Nenciuda43deb9ea03
diff --git a/plugins/chat/db/migrate/20241029192512_alter_chat_ids_to_bigint.rb b/plugins/chat/db/migrate/20241029192512_alter_chat_ids_to_bigint.rb
new file mode 100644
index 00000000000..802ecd735fa
--- /dev/null
+++ b/plugins/chat/db/migrate/20241029192512_alter_chat_ids_to_bigint.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AlterChatIdsToBigint < ActiveRecord::Migration[7.1]
+ def up
+ change_column :chat_channel_archives, :chat_channel_id, :bigint
+ change_column :chat_channels, :chatable_id, :bigint
+ change_column :chat_drafts, :chat_channel_id, :bigint
+ change_column :chat_mention_notifications, :chat_mention_id, :bigint
+ change_column :chat_mention_notifications, :notification_id, :bigint
+ change_column :chat_mentions, :chat_message_id, :bigint
+ change_column :chat_message_reactions, :chat_message_id, :bigint
+ change_column :chat_message_revisions, :chat_message_id, :bigint
+ change_column :chat_messages, :chat_channel_id, :bigint
+ change_column :chat_messages, :in_reply_to_id, :bigint
+ change_column :chat_webhook_events, :chat_message_id, :bigint
+ change_column :chat_webhook_events, :incoming_chat_webhook_id, :bigint
+ change_column :direct_message_users, :direct_message_channel_id, :bigint
+ change_column :incoming_chat_webhooks, :chat_channel_id, :bigint
+ change_column :user_chat_channel_memberships, :chat_channel_id, :bigint
+ change_column :user_chat_channel_memberships, :last_read_message_id, :bigint
+ change_column :user_chat_channel_memberships, :last_unread_mention_when_emailed_id, :bigint
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/plugins/chat/spec/plugin_helper.rb b/plugins/chat/spec/plugin_helper.rb
index 2982b1769e7..e7b365b7d87 100644
--- a/plugins/chat/spec/plugin_helper.rb
+++ b/plugins/chat/spec/plugin_helper.rb
@@ -153,24 +153,4 @@ RSpec.configure do |config|
# Or a very large value, if you do want to truncate at some point
c.max_formatted_output_length = nil
end
-
- config.before(:suite) do
- migrate_column_to_bigint(Chat::Channel, :chatable_id)
- migrate_column_to_bigint(Chat::ChannelArchive, :chat_channel_id)
- migrate_column_to_bigint(Chat::DirectMessageUser, :direct_message_channel_id)
- migrate_column_to_bigint(Chat::Draft, :chat_channel_id)
- migrate_column_to_bigint(Chat::IncomingWebhook, :chat_channel_id)
- migrate_column_to_bigint(Chat::Mention, :chat_message_id)
- migrate_column_to_bigint(Chat::MentionNotification, :chat_mention_id)
- migrate_column_to_bigint(Chat::MentionNotification, :notification_id)
- migrate_column_to_bigint(Chat::Message, :chat_channel_id)
- migrate_column_to_bigint(Chat::Message, :in_reply_to_id)
- migrate_column_to_bigint(Chat::MessageReaction, :chat_message_id)
- migrate_column_to_bigint(Chat::MessageRevision, :chat_message_id)
- migrate_column_to_bigint(Chat::UserChatChannelMembership, :chat_channel_id)
- migrate_column_to_bigint(Chat::UserChatChannelMembership, :last_read_message_id)
- migrate_column_to_bigint(Chat::UserChatChannelMembership, :last_unread_mention_when_emailed_id)
- migrate_column_to_bigint(Chat::WebhookEvent, :chat_message_id)
- migrate_column_to_bigint(Chat::WebhookEvent, :incoming_chat_webhook_id)
- end
end