Browse Source

Merged migrations.

Martin Edenhofer 9 years ago
parent
commit
2e295ce004

+ 4 - 4
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

+ 7 - 7
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

+ 0 - 9
db/migrate/20151113000001_update_chat.rb

@@ -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

+ 0 - 6
db/migrate/20151115000001_update2_chat.rb

@@ -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

+ 0 - 12
db/migrate/20151115000003_update_history.rb

@@ -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

+ 0 - 5
db/migrate/20151117000001_update3_chat.rb

@@ -1,5 +0,0 @@
-class Update3Chat < ActiveRecord::Migration
-  def up
-    add_column :chats, :preferences, :string, limit: 5000, null: true
-  end
-end