From 0b37e11ebfcba5f903407d72f0cdf19261c56e75 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 17 Jul 2023 13:30:18 +0530 Subject: [PATCH] feat: add conversation summary fields --- app/models/conversation.rb | 2 ++ ...819_add_summary_fields_to_conversations.rb | 6 +++++ db/schema.rb | 22 ++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20230717075819_add_summary_fields_to_conversations.rb diff --git a/app/models/conversation.rb b/app/models/conversation.rb index 25fa48c0d..44a78e100 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -14,6 +14,8 @@ # priority :integer # snoozed_until :datetime # status :integer default("open"), not null +# summary :string +# summary_generated_at :datetime # uuid :uuid not null # waiting_since :datetime # created_at :datetime not null diff --git a/db/migrate/20230717075819_add_summary_fields_to_conversations.rb b/db/migrate/20230717075819_add_summary_fields_to_conversations.rb new file mode 100644 index 000000000..7e8a41902 --- /dev/null +++ b/db/migrate/20230717075819_add_summary_fields_to_conversations.rb @@ -0,0 +1,6 @@ +class AddSummaryFieldsToConversations < ActiveRecord::Migration[7.0] + def change + add_column :conversations, :summary, :string + add_column :conversations, :summary_generated_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index ab3986e15..bf3fc750b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do +ActiveRecord::Schema[7.0].define(version: 2023_07_17_075819) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "pg_trgm" @@ -449,8 +449,10 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do t.datetime "assignee_last_seen_at", precision: nil t.datetime "first_reply_created_at", precision: nil t.integer "priority" - t.bigint "sla_policy_id" t.datetime "waiting_since" + t.bigint "sla_policy_id" + t.string "summary" + t.datetime "summary_generated_at" t.index ["account_id", "display_id"], name: "index_conversations_on_account_id_and_display_id", unique: true t.index ["account_id", "id"], name: "index_conversations_on_id_and_account_id" t.index ["account_id", "inbox_id", "status", "assignee_id"], name: "conv_acid_inbid_stat_asgnid_idx" @@ -585,8 +587,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do t.jsonb "auto_assignment_config", default: {} t.boolean "lock_to_single_conversation", default: false, null: false t.bigint "portal_id" - t.string "business_name" t.integer "sender_name_type", default: 0, null: false + t.string "business_name" t.index ["account_id"], name: "index_inboxes_on_account_id" t.index ["channel_id", "channel_type"], name: "index_inboxes_on_channel_id_and_channel_type" t.index ["portal_id"], name: "index_inboxes_on_portal_id" @@ -615,6 +617,19 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do t.jsonb "settings", default: {} end + create_table "label_associations", force: :cascade do |t| + t.bigint "label_id", null: false + t.string "labelable_type", null: false + t.bigint "labelable_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["label_id"], name: "index_label_associations_on_label_id" + t.index ["labelable_type", "labelable_id"], name: "index_label_associations_on_contact", where: "((labelable_type)::text = 'Contact'::text)" + t.index ["labelable_type", "labelable_id"], name: "index_label_associations_on_conversation", where: "((labelable_type)::text = 'Conversation'::text)" + t.index ["labelable_type", "labelable_id"], name: "index_label_associations_on_labelable" + t.index ["labelable_type", "labelable_id"], name: "index_label_associations_on_labelable_type_and_labelable_id" + end + create_table "labels", force: :cascade do |t| t.string "title" t.text "description" @@ -944,6 +959,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "inboxes", "portals" + add_foreign_key "label_associations", "labels" create_trigger("accounts_after_insert_row_tr", :generated => true, :compatibility => 1). on("accounts"). after(:insert).