Merged migrations.

This commit is contained in:
Martin Edenhofer 2015-09-26 13:32:33 +02:00
parent 7aaceda8bd
commit aaaf79120d
5 changed files with 11 additions and 66 deletions

View file

@ -3,11 +3,13 @@ class CreateBase < ActiveRecord::Migration
create_table :sessions do |t|
t.string :session_id, null: false
t.boolean :persistent, null: true
t.text :data
t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
add_index :sessions, :persistent
create_table :users do |t|
t.references :organization, null: true

View file

@ -34,11 +34,11 @@ class CreateTicket < ActiveRecord::Migration
t.references :priority, null: false
t.references :state, null: false
t.references :organization, null: true
t.column :number, :string, limit: 60, null: false
t.column :title, :string, limit: 250, null: false
t.column :number, :string, limit: 60, null: false
t.column :title, :string, limit: 250, null: false
t.column :owner_id, :integer, null: false
t.column :customer_id, :integer, null: false
t.column :note, :string, limit: 250, null: true
t.column :note, :string, limit: 250, null: true
t.column :first_response, :timestamp, null: true
t.column :first_response_escal_date, :timestamp, null: true
t.column :first_response_sla_time, :timestamp, null: true
@ -60,6 +60,8 @@ class CreateTicket < ActiveRecord::Migration
t.column :create_article_sender_id, :integer, null: true
t.column :article_count, :integer, null: true
t.column :escalation_time, :timestamp, null: true
t.column :pending_time, :timestamp, null: true
t.column :type, :string, limit: 100, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
@ -89,6 +91,8 @@ class CreateTicket < ActiveRecord::Migration
add_index :tickets, [:create_article_type_id]
add_index :tickets, [:create_article_sender_id]
add_index :tickets, [:created_by_id]
add_index :tickets, [:pending_time]
add_index :tickets, [:type]
create_table :ticket_flags do |t|
t.references :tickets, null: false
@ -317,11 +321,11 @@ class CreateTicket < ActiveRecord::Migration
add_index :channels, [:adapter]
create_table :slas do |t|
t.column :name, :string, limit: 150, null: true
t.column :name, :string, limit: 150, null: true
t.column :first_response_time, :integer, null: true
t.column :update_time, :integer, null: true
t.column :close_time, :integer, null: true
t.column :condition, :string, limit: 5000, null: true
t.column :condition, :string, limit: 5000, null: true
t.column :data, :string, limit: 5000, null: true
t.column :timezone, :string, limit: 50, null: true
t.column :active, :boolean, null: false, default: true

View file

@ -1,9 +0,0 @@
class UpdateSession < ActiveRecord::Migration
def up
add_column :sessions, :request_type, :integer, null: true
add_index :sessions, :request_type
end
def down
end
end

View file

@ -1,28 +0,0 @@
class ProcessPendingTickets < ActiveRecord::Migration
def up
# fix wrong next_state_id for state 'pending close'
pending_close_state = Ticket::State.find_by(
name: 'pending close',
)
if pending_close_state
closed_state = Ticket::State.find_by(
name: 'closed',
)
pending_close_state.next_state_id = closed_state.id
pending_close_state.save!
end
# add Ticket.process_pending
Scheduler.create_or_update(
name: 'Process pending tickets',
method: 'Ticket.process_pending',
period: 60 * 15,
prio: 1,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
end
end

View file

@ -1,24 +0,0 @@
class SessionChanges < ActiveRecord::Migration
def up
ActiveRecord::SessionStore::Session.delete_all
remove_index :sessions, :request_type
remove_column :sessions, :request_type
add_column :sessions, :persistent, :boolean, null: true
add_index :sessions, :persistent
end
def down
ActiveRecord::SessionStore::Session.delete_all
remove_index :sessions, :persistent
remove_column :sessions, :persistent
add_column :sessions, :request_type, :integer, null: true
add_index :sessions, :request_type
end
end