Add support for persistent copilot messages and threads
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
class CreateCopilotThreads < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :copilot_threads do |t|
|
||||
t.string :title, null: false
|
||||
t.references :user, null: false, index: true
|
||||
t.references :account, null: false, index: true
|
||||
t.uuid :uuid, null: false, default: 'gen_random_uuid()'
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :copilot_threads, :uuid, unique: true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
class CreateCopilotMessages < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :copilot_messages do |t|
|
||||
t.references :copilot_thread, null: false, index: true
|
||||
t.references :user, null: false, index: true
|
||||
t.references :account, null: false, index: true
|
||||
t.string :message_type, null: false
|
||||
t.jsonb :message, null: false, default: {}
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
+26
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2025_04_21_085134) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2025_05_12_231037) do
|
||||
# These extensions should be enabled to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "pg_trgm"
|
||||
@@ -575,6 +575,31 @@ ActiveRecord::Schema[7.0].define(version: 2025_04_21_085134) do
|
||||
t.index ["waiting_since"], name: "index_conversations_on_waiting_since"
|
||||
end
|
||||
|
||||
create_table "copilot_messages", force: :cascade do |t|
|
||||
t.bigint "copilot_thread_id", null: false
|
||||
t.bigint "user_id", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.string "message_type", null: false
|
||||
t.jsonb "message", default: {}, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_copilot_messages_on_account_id"
|
||||
t.index ["copilot_thread_id"], name: "index_copilot_messages_on_copilot_thread_id"
|
||||
t.index ["user_id"], name: "index_copilot_messages_on_user_id"
|
||||
end
|
||||
|
||||
create_table "copilot_threads", force: :cascade do |t|
|
||||
t.string "title", null: false
|
||||
t.bigint "user_id", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_copilot_threads_on_account_id"
|
||||
t.index ["user_id"], name: "index_copilot_threads_on_user_id"
|
||||
t.index ["uuid"], name: "index_copilot_threads_on_uuid", unique: true
|
||||
end
|
||||
|
||||
create_table "csat_survey_responses", force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "conversation_id", null: false
|
||||
|
||||
Reference in New Issue
Block a user