0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/plugins/chat/db/migrate/20251203000005_create_chat_message_links.rb
Martin Brennan 738ce6e885
DEV: Fix duplicate migration version (#36469)
In
861e2d8bcf
we introduced a duplicate migration version (20251203000001) which
conflicts with core/chat. This commit renames the migration file to
20251203000005 to resolve the conflict, and adds safety to the
migration for sites that have already run it so it is not repeated.
2025-12-05 11:22:21 +10:00

19 lines
616 B
Ruby
Vendored

# frozen_string_literal: true
class CreateChatMessageLinks < ActiveRecord::Migration[7.2]
def change
create_table :chat_message_links, if_not_exists: true do |t|
t.bigint :chat_message_id, null: false
t.string :url, null: false, limit: 500
t.timestamps
end
add_index :chat_message_links, :chat_message_id, if_not_exists: true
add_index :chat_message_links, :url, if_not_exists: true
add_index :chat_message_links,
%i[chat_message_id url],
unique: true,
name: "unique_chat_message_links",
if_not_exists: true
end
end