Merged migrations.

This commit is contained in:
Martin Edenhofer 2015-12-12 23:32:25 +01:00
parent ee87075b23
commit 2e295ce004
6 changed files with 11 additions and 43 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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