Enhancement: Move reporting metrics to postgres (#606)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
class AddNotificationSettings < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
return if ActiveRecord::Base.connection.data_source_exists? 'notification_settings'
|
||||
|
||||
create_table :notification_settings do |t|
|
||||
t.integer :account_id
|
||||
t.integer :user_id
|
||||
14
db/migrate/20200310062527_create_events.rb
Normal file
14
db/migrate/20200310062527_create_events.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateEvents < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :events do |t|
|
||||
t.string :name
|
||||
t.float :value
|
||||
t.integer :account_id
|
||||
t.integer :inbox_id
|
||||
t.integer :user_id
|
||||
t.integer :conversation_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
9
db/migrate/20200310070540_add_index_to_event.rb
Normal file
9
db/migrate/20200310070540_add_index_to_event.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddIndexToEvent < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_index :events, :name
|
||||
add_index :events, :created_at
|
||||
add_index :events, :account_id
|
||||
add_index :events, :inbox_id
|
||||
add_index :events, :user_id
|
||||
end
|
||||
end
|
||||
7
db/migrate/20200311083854_add_index_to_message.rb
Normal file
7
db/migrate/20200311083854_add_index_to_message.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class AddIndexToMessage < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_index :messages, :account_id
|
||||
add_index :messages, :inbox_id
|
||||
add_index :messages, :user_id
|
||||
end
|
||||
end
|
||||
21
db/schema.rb
21
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_03_09_213132) do
|
||||
ActiveRecord::Schema.define(version: 2020_03_11_083854) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -179,6 +179,22 @@ ActiveRecord::Schema.define(version: 2020_03_09_213132) do
|
||||
t.index ["contact_inbox_id"], name: "index_conversations_on_contact_inbox_id"
|
||||
end
|
||||
|
||||
create_table "events", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.float "value"
|
||||
t.integer "account_id"
|
||||
t.integer "inbox_id"
|
||||
t.integer "user_id"
|
||||
t.integer "conversation_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["account_id"], name: "index_events_on_account_id"
|
||||
t.index ["created_at"], name: "index_events_on_created_at"
|
||||
t.index ["inbox_id"], name: "index_events_on_inbox_id"
|
||||
t.index ["name"], name: "index_events_on_name"
|
||||
t.index ["user_id"], name: "index_events_on_user_id"
|
||||
end
|
||||
|
||||
create_table "inbox_members", id: :serial, force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.integer "inbox_id", null: false
|
||||
@@ -213,9 +229,12 @@ ActiveRecord::Schema.define(version: 2020_03_09_213132) do
|
||||
t.integer "content_type", default: 0
|
||||
t.json "content_attributes", default: {}
|
||||
t.bigint "contact_id"
|
||||
t.index ["account_id"], name: "index_messages_on_account_id"
|
||||
t.index ["contact_id"], name: "index_messages_on_contact_id"
|
||||
t.index ["conversation_id"], name: "index_messages_on_conversation_id"
|
||||
t.index ["inbox_id"], name: "index_messages_on_inbox_id"
|
||||
t.index ["source_id"], name: "index_messages_on_source_id"
|
||||
t.index ["user_id"], name: "index_messages_on_user_id"
|
||||
end
|
||||
|
||||
create_table "notification_settings", force: :cascade do |t|
|
||||
|
||||
Reference in New Issue
Block a user