diff --git a/app/models/conversation.rb b/app/models/conversation.rb index efd3aa963..be9bf26ab 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -7,12 +7,12 @@ # agent_last_seen_at :datetime # contact_last_seen_at :datetime # identifier :string -# last_activity_at :datetime +# last_activity_at :datetime not null # locked :boolean default(FALSE) # status :integer default("open"), not null # uuid :uuid not null -# created_at :datetime -# updated_at :datetime +# created_at :datetime not null +# updated_at :datetime not null # account_id :integer not null # assignee_id :integer # contact_id :bigint diff --git a/db/migrate/20210105185632_enable_pg_stats_extention.rb b/db/migrate/20210105185632_enable_pg_stats_extention.rb new file mode 100644 index 000000000..f03b0dc20 --- /dev/null +++ b/db/migrate/20210105185632_enable_pg_stats_extention.rb @@ -0,0 +1,5 @@ +class EnablePgStatsExtention < ActiveRecord::Migration[6.0] + def change + enable_extension 'pg_stat_statements' + end +end diff --git a/db/schema.rb b/db/schema.rb index e7c0eb71d..63aa46271 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.define(version: 2020_11_25_123131) do +ActiveRecord::Schema.define(version: 2021_01_05_185632) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" @@ -219,8 +219,8 @@ ActiveRecord::Schema.define(version: 2020_11_25_123131) do t.integer "inbox_id", null: false t.integer "status", default: 0, null: false t.integer "assignee_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.bigint "contact_id" t.integer "display_id", null: false t.datetime "contact_last_seen_at" @@ -230,7 +230,7 @@ ActiveRecord::Schema.define(version: 2020_11_25_123131) do t.bigint "contact_inbox_id" t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false t.string "identifier" - t.datetime "last_activity_at", default: -> { "CURRENT_TIMESTAMP" } + t.datetime "last_activity_at", default: -> { "CURRENT_TIMESTAMP" }, null: false t.index ["account_id", "display_id"], name: "index_conversations_on_account_id_and_display_id", unique: true t.index ["account_id"], name: "index_conversations_on_account_id" t.index ["contact_inbox_id"], name: "index_conversations_on_contact_inbox_id" @@ -456,9 +456,11 @@ ActiveRecord::Schema.define(version: 2020_11_25_123131) do t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy" t.index ["taggable_id"], name: "index_taggings_on_taggable_id" + t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable_type_and_taggable_id" t.index ["taggable_type"], name: "index_taggings_on_taggable_type" t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type" t.index ["tagger_id"], name: "index_taggings_on_tagger_id" + t.index ["tagger_type", "tagger_id"], name: "index_taggings_on_tagger_type_and_tagger_id" end create_table "tags", id: :serial, force: :cascade do |t|