From 2e295ce0045acac2bb9a44c0bf6541af17ec03b6 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 12 Dec 2015 23:32:25 +0100 Subject: [PATCH] Merged migrations. --- db/migrate/20120101000001_create_base.rb | 8 ++++---- db/migrate/20151109000001_create_chat.rb | 14 +++++++------- db/migrate/20151113000001_update_chat.rb | 9 --------- db/migrate/20151115000001_update2_chat.rb | 6 ------ db/migrate/20151115000003_update_history.rb | 12 ------------ db/migrate/20151117000001_update3_chat.rb | 5 ----- 6 files changed, 11 insertions(+), 43 deletions(-) delete mode 100644 db/migrate/20151113000001_update_chat.rb delete mode 100644 db/migrate/20151115000001_update2_chat.rb delete mode 100644 db/migrate/20151115000003_update_history.rb delete mode 100644 db/migrate/20151117000001_update3_chat.rb diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index 30240a980..099a36522 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -283,8 +283,8 @@ class CreateBase < ActiveRecord::Migration t.integer :related_history_object_id, null: true t.integer :id_to, null: true t.integer :id_from, null: true - t.string :value_from, limit: 250, null: true - t.string :value_to, limit: 250, null: true + t.string :value_from, limit: 500, null: true + t.string :value_to, limit: 500, null: true t.integer :created_by_id, null: false t.timestamps null: false end @@ -296,8 +296,8 @@ class CreateBase < ActiveRecord::Migration add_index :histories, [:history_type_id] add_index :histories, [:id_to] add_index :histories, [:id_from] - add_index :histories, [:value_from] - add_index :histories, [:value_to] + add_index :histories, [:value_from], length: 255 + add_index :histories, [:value_to], length: 255 create_table :history_types do |t| t.string :name, limit: 250, null: false diff --git a/db/migrate/20151109000001_create_chat.rb b/db/migrate/20151109000001_create_chat.rb index e4d3e6670..50d856c3d 100644 --- a/db/migrate/20151109000001_create_chat.rb +++ b/db/migrate/20151109000001_create_chat.rb @@ -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 diff --git a/db/migrate/20151113000001_update_chat.rb b/db/migrate/20151113000001_update_chat.rb deleted file mode 100644 index 4cfa73acd..000000000 --- a/db/migrate/20151113000001_update_chat.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateChat < ActiveRecord::Migration - def up - add_index :chat_sessions, [:session_id] - add_index :chat_sessions, [:chat_id] - add_index :chat_messages, [:chat_session_id] - add_index :chat_agents, [:active] - add_index :chat_agents, [:updated_by_id], unique: true - end -end diff --git a/db/migrate/20151115000001_update2_chat.rb b/db/migrate/20151115000001_update2_chat.rb deleted file mode 100644 index f0a23906b..000000000 --- a/db/migrate/20151115000001_update2_chat.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Update2Chat < ActiveRecord::Migration - def up - add_column :chats, :public, :boolean, null: false, default: false - drop_table :chat_topics - end -end diff --git a/db/migrate/20151115000003_update_history.rb b/db/migrate/20151115000003_update_history.rb deleted file mode 100644 index f939fc225..000000000 --- a/db/migrate/20151115000003_update_history.rb +++ /dev/null @@ -1,12 +0,0 @@ -class UpdateHistory < ActiveRecord::Migration - def up - remove_index :histories, [:value_from] - remove_index :histories, [:value_to] - change_table(:histories) do |t| - t.change :value_from, :text, limit: 500, null: true - t.change :value_to, :text, limit: 500, null: true - end - add_index :histories, [:value_from], length: 255 - add_index :histories, [:value_to], length: 255 - end -end diff --git a/db/migrate/20151117000001_update3_chat.rb b/db/migrate/20151117000001_update3_chat.rb deleted file mode 100644 index 44aa95fe9..000000000 --- a/db/migrate/20151117000001_update3_chat.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Update3Chat < ActiveRecord::Migration - def up - add_column :chats, :preferences, :string, limit: 5000, null: true - end -end