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:
Sam
2024-11-01 09:12:19 +11:00
committed by GitHub
parent 29d3b9b03e
commit e7f62ab52b
10 changed files with 140 additions and 11 deletions

View File

@ -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