Merged migrations.

This commit is contained in:
Martin Edenhofer 2016-04-29 14:26:48 +02:00
parent 882beff8fa
commit 4847fa1e42
4 changed files with 28 additions and 40 deletions

View file

@ -9,12 +9,30 @@ class CreateCtiLog < ActiveRecord::Migration
t.string :to_comment, limit: 250, null: true
t.string :call_id, limit: 250, null: false
t.string :comment, limit: 500, null: true
t.timestamp :start, null: true
t.timestamp :end, null: true
t.boolean :done, null: false, default: true
t.timestamps null: false
end
add_index :cti_logs, [:call_id], unique: true
add_index :cti_logs, [:direction]
add_index :cti_logs, [:from]
create_table :cti_caller_ids do |t|
t.string :caller_id, limit: 100, null: false
t.string :comment, limit: 500, null: true
t.string :level, limit: 100, null: false
t.string :object, limit: 100, null: false
t.integer :o_id, null: false
t.integer :user_id, null: true
t.text :preferences, limit: 500.kilobytes + 1, null: true
t.timestamps null: false
end
add_index :cti_caller_ids, [:caller_id]
add_index :cti_caller_ids, [:caller_id, :level]
add_index :cti_caller_ids, [:caller_id, :user_id]
add_index :cti_caller_ids, [:object, :o_id]
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
@ -25,5 +43,15 @@ class CreateCtiLog < ActiveRecord::Migration
created_by_id: 1
)
Setting.create_if_not_exists(
title: 'Define transaction backend.',
name: '9100_cti_caller_id_detection',
area: 'Transaction::Backend',
description: 'Define the transaction backend which detects caller ids in objects and store them for cti lookups.',
options: {},
state: 'Transaction::CtiCallerIdDetection',
frontend: false
)
end
end

View file

@ -1,7 +0,0 @@
class UpdateCtiLog < ActiveRecord::Migration
def up
add_column :cti_logs, :start, :timestamp, null: true
add_column :cti_logs, :end, :timestamp, null: true
add_column :cti_logs, :done, :boolean, null: false, default: true
end
end

View file

@ -1,19 +0,0 @@
class CreateCtiCallerId < ActiveRecord::Migration
def up
create_table :cti_caller_ids do |t|
t.string :caller_id, limit: 100, null: false
t.string :comment, limit: 500, null: true
t.string :level, limit: 100, null: false
t.string :object, limit: 100, null: false
t.integer :o_id, null: false
t.integer :user_id, null: true
t.timestamps null: false
end
add_index :cti_caller_ids, [:caller_id]
add_index :cti_caller_ids, [:caller_id, :level]
add_index :cti_caller_ids, [:caller_id, :user_id]
add_index :cti_caller_ids, [:object, :o_id]
end
end

View file

@ -1,14 +0,0 @@
class UpdateCtiCallerId < ActiveRecord::Migration
def up
Setting.create_if_not_exists(
title: 'Define transaction backend.',
name: '9100_cti_caller_id_detection',
area: 'Transaction::Backend',
description: 'Define the transaction backend which detects caller ids in objects and store them for cti lookups.',
options: {},
state: 'Transaction::CtiCallerIdDetection',
frontend: false
)
add_column :cti_logs, :preferences, :text, limit: 500.kilobytes + 1, null: true
end
end