mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FEATURE: add custom fields to chat (channel/message/thread) (#29504)
This allows various extensions to store extra information the 3 most popular chat entities Useful for certain plugins and migrations
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddCustomFieldsToChat < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :chat_thread_custom_fields do |t|
|
||||
t.bigint :thread_id, null: false
|
||||
t.string :name, limit: 256, null: false
|
||||
t.string :value, limit: 1_000_000
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :chat_message_custom_fields do |t|
|
||||
t.bigint :message_id, null: false
|
||||
t.string :name, limit: 256, null: false
|
||||
t.string :value, limit: 1_000_000
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :chat_channel_custom_fields do |t|
|
||||
t.bigint :channel_id, null: false
|
||||
t.string :name, limit: 256, null: false
|
||||
t.string :value, limit: 1_000_000
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :chat_thread_custom_fields, %i[thread_id name], unique: true
|
||||
add_index :chat_message_custom_fields, %i[message_id name], unique: true
|
||||
add_index :chat_channel_custom_fields, %i[channel_id name], unique: true
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user