|
@@ -5,6 +5,8 @@ class CreateChat < ActiveRecord::Migration
|
|
|
t.integer :max_queue, null: false, default: 5
|
|
|
t.string :note, limit: 250, null: true
|
|
|
t.boolean :active, null: false, default: true
|
|
|
+ t.boolean :public, null: false, default: false
|
|
|
+ t.string :preferences, limit: 5000, null: true
|
|
|
t.integer :updated_by_id, null: false
|
|
|
t.integer :created_by_id, null: false
|
|
|
t.timestamps null: false
|
|
@@ -32,8 +34,10 @@ class CreateChat < ActiveRecord::Migration
|
|
|
t.integer :created_by_id, null: true
|
|
|
t.timestamps null: false
|
|
|
end
|
|
|
+ add_index :chat_sessions, [:session_id]
|
|
|
add_index :chat_sessions, [:state]
|
|
|
add_index :chat_sessions, [:user_id]
|
|
|
+ add_index :chat_sessions, [:chat_id]
|
|
|
|
|
|
create_table :chat_messages do |t|
|
|
|
t.integer :chat_session_id, null: false
|
|
@@ -41,6 +45,7 @@ class CreateChat < ActiveRecord::Migration
|
|
|
t.integer :created_by_id, null: true
|
|
|
t.timestamps null: false
|
|
|
end
|
|
|
+ add_index :chat_messages, [:chat_session_id]
|
|
|
|
|
|
create_table :chat_agents do |t|
|
|
|
t.boolean :active, null: false, default: true
|
|
@@ -49,6 +54,8 @@ class CreateChat < ActiveRecord::Migration
|
|
|
t.integer :created_by_id, null: false
|
|
|
t.timestamps null: false
|
|
|
end
|
|
|
+ add_index :chat_agents, [:active]
|
|
|
+ add_index :chat_agents, [:updated_by_id], unique: true
|
|
|
add_index :chat_agents, [:created_by_id], unique: true
|
|
|
|
|
|
# return if it's a new setup
|
|
@@ -70,13 +77,6 @@ class CreateChat < ActiveRecord::Migration
|
|
|
created_by_id: 1,
|
|
|
)
|
|
|
|
|
|
- chat_topic = Chat::Topic.create(
|
|
|
- chat_id: chat.id,
|
|
|
- name: 'default',
|
|
|
- updated_by_id: 1,
|
|
|
- created_by_id: 1,
|
|
|
- )
|
|
|
-
|
|
|
end
|
|
|
|
|
|
def down
|