* feat: add priority * feat: add indexes
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
# first_reply_created_at :datetime
|
||||
# identifier :string
|
||||
# last_activity_at :datetime not null
|
||||
# priority :integer
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
@@ -38,7 +39,9 @@
|
||||
# index_conversations_on_id_and_account_id (account_id,id)
|
||||
# index_conversations_on_inbox_id (inbox_id)
|
||||
# index_conversations_on_last_activity_at (last_activity_at)
|
||||
# index_conversations_on_priority (priority)
|
||||
# index_conversations_on_status_and_account_id (status,account_id)
|
||||
# index_conversations_on_status_and_priority (status,priority)
|
||||
# index_conversations_on_team_id (team_id)
|
||||
# index_conversations_on_uuid (uuid) UNIQUE
|
||||
#
|
||||
@@ -61,6 +64,7 @@ class Conversation < ApplicationRecord
|
||||
validate :validate_referer_url
|
||||
|
||||
enum status: { open: 0, resolved: 1, pending: 2, snoozed: 3 }
|
||||
enum priority: { low: 0, medium: 1, high: 2, urgent: 3 }
|
||||
|
||||
scope :unassigned, -> { where(assignee_id: nil) }
|
||||
scope :assigned, -> { where.not(assignee_id: nil) }
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class AddPriorityToConversation < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :conversations, :priority, :integer
|
||||
add_index :conversations, :priority
|
||||
add_index :conversations, [:status, :priority]
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2023_04_07_191457) do
|
||||
ActiveRecord::Schema.define(version: 2023_04_18_100944) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
@@ -446,6 +446,7 @@ ActiveRecord::Schema.define(version: 2023_04_07_191457) do
|
||||
t.jsonb "custom_attributes", default: {}
|
||||
t.datetime "assignee_last_seen_at"
|
||||
t.datetime "first_reply_created_at"
|
||||
t.integer "priority"
|
||||
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"
|
||||
@@ -457,7 +458,9 @@ ActiveRecord::Schema.define(version: 2023_04_07_191457) do
|
||||
t.index ["first_reply_created_at"], name: "index_conversations_on_first_reply_created_at"
|
||||
t.index ["inbox_id"], name: "index_conversations_on_inbox_id"
|
||||
t.index ["last_activity_at"], name: "index_conversations_on_last_activity_at"
|
||||
t.index ["priority"], name: "index_conversations_on_priority"
|
||||
t.index ["status", "account_id"], name: "index_conversations_on_status_and_account_id"
|
||||
t.index ["status", "priority"], name: "index_conversations_on_status_and_priority"
|
||||
t.index ["team_id"], name: "index_conversations_on_team_id"
|
||||
t.index ["uuid"], name: "index_conversations_on_uuid", unique: true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user