Merged several migrations.
This commit is contained in:
parent
37f421a4e5
commit
da06ddaa63
6 changed files with 59 additions and 327 deletions
|
@ -263,6 +263,65 @@ class CreateBase < ActiveRecord::Migration
|
|||
add_index :activity_streams, [:activity_stream_object_id]
|
||||
add_index :activity_streams, [:activity_stream_type_id]
|
||||
|
||||
create_table :histories do |t|
|
||||
t.references :history_type, :null => false
|
||||
t.references :history_object, :null => false
|
||||
t.references :history_attribute, :null => true
|
||||
t.column :o_id, :integer, :null => false
|
||||
t.column :related_o_id, :integer, :null => true
|
||||
t.column :related_history_object_id, :integer, :null => true
|
||||
t.column :id_to, :integer, :null => true
|
||||
t.column :id_from, :integer, :null => true
|
||||
t.column :value_from, :string, :limit => 250, :null => true
|
||||
t.column :value_to, :string, :limit => 250, :null => true
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :histories, [:o_id]
|
||||
add_index :histories, [:created_by_id]
|
||||
add_index :histories, [:created_at]
|
||||
add_index :histories, [:history_object_id]
|
||||
add_index :histories, [:history_attribute_id]
|
||||
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]
|
||||
|
||||
create_table :history_types do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :history_types, [:name], :unique => true
|
||||
|
||||
create_table :history_objects do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.timestamps
|
||||
end
|
||||
add_index :history_objects, [:name], :unique => true
|
||||
|
||||
create_table :history_attributes do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :history_attributes, [:name], :unique => true
|
||||
|
||||
|
||||
create_table :settings do |t|
|
||||
t.column :title, :string, :limit => 200, :null => false
|
||||
t.column :name, :string, :limit => 200, :null => false
|
||||
t.column :area, :string, :limit => 100, :null => false
|
||||
t.column :description, :string, :limit => 2000, :null => false
|
||||
t.column :options, :string, :limit => 2000, :null => true
|
||||
t.column :state, :string, :limit => 2000, :null => true
|
||||
t.column :state_initial, :string, :limit => 2000, :null => true
|
||||
t.column :frontend, :boolean, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :settings, [:name], :unique => true
|
||||
add_index :settings, [:area]
|
||||
add_index :settings, [:frontend]
|
||||
|
||||
end
|
||||
end
|
|
@ -1,55 +0,0 @@
|
|||
class CreateHistory < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
create_table :histories do |t|
|
||||
t.references :history_type, :null => false
|
||||
t.references :history_object, :null => false
|
||||
t.references :history_attribute, :null => true
|
||||
t.column :o_id, :integer, :null => false
|
||||
t.column :related_o_id, :integer, :null => true
|
||||
t.column :related_history_object_id, :integer, :null => true
|
||||
t.column :id_to, :integer, :null => true
|
||||
t.column :id_from, :integer, :null => true
|
||||
t.column :value_from, :string, :limit => 250, :null => true
|
||||
t.column :value_to, :string, :limit => 250, :null => true
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :histories, [:o_id]
|
||||
add_index :histories, [:created_by_id]
|
||||
add_index :histories, [:created_at]
|
||||
add_index :histories, [:history_object_id]
|
||||
add_index :histories, [:history_attribute_id]
|
||||
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]
|
||||
|
||||
create_table :history_types do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :history_types, [:name], :unique => true
|
||||
|
||||
create_table :history_objects do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.timestamps
|
||||
end
|
||||
add_index :history_objects, [:name], :unique => true
|
||||
|
||||
create_table :history_attributes do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :history_attributes, [:name], :unique => true
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :histories
|
||||
drop_table :history_attributes
|
||||
drop_table :history_objects
|
||||
drop_table :history_types
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
class CreateSetting < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :settings do |t|
|
||||
t.column :title, :string, :limit => 200, :null => false
|
||||
t.column :name, :string, :limit => 200, :null => false
|
||||
t.column :area, :string, :limit => 100, :null => false
|
||||
t.column :description, :string, :limit => 2000, :null => false
|
||||
t.column :options, :string, :limit => 2000, :null => true
|
||||
t.column :state, :string, :limit => 2000, :null => true
|
||||
t.column :state_initial, :string, :limit => 2000, :null => true
|
||||
t.column :frontend, :boolean, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :settings, [:name], :unique => true
|
||||
add_index :settings, [:area]
|
||||
add_index :settings, [:frontend]
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :settings
|
||||
end
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
require 'user'
|
||||
require 'setting'
|
||||
class SettingUpdate < ActiveRecord::Migration
|
||||
def up
|
||||
count = User.all.count()
|
||||
if count > 2
|
||||
Setting.create_or_update(
|
||||
:title => 'System Init Done',
|
||||
:name => 'system_init_done',
|
||||
:area => 'Core',
|
||||
:description => 'Defines if application is in init mode.',
|
||||
:options => {},
|
||||
:state => true,
|
||||
:frontend => true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
class UpdateGeo2 < ActiveRecord::Migration
|
||||
def up
|
||||
Setting.create_if_not_exists(
|
||||
:title => 'Geo Location Backend',
|
||||
:name => 'geo_location_backend',
|
||||
:area => 'System::Geo',
|
||||
:description => 'Defines the backend for geo location lookups.',
|
||||
:options => {
|
||||
:form => [
|
||||
{
|
||||
:display => '',
|
||||
:null => true,
|
||||
:name => 'geo_location_backend',
|
||||
:tag => 'select',
|
||||
:options => {
|
||||
'' => '-',
|
||||
'GeoLocation::Gmaps' => 'Google Maps',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
:state => 'GeoLocation::Gmaps',
|
||||
:frontend => false
|
||||
)
|
||||
Setting.create_if_not_exists(
|
||||
:title => 'Geo IP Backend',
|
||||
:name => 'geo_ip_backend',
|
||||
:area => 'System::Geo',
|
||||
:description => 'Defines the backend for geo ip lookups.',
|
||||
:options => {
|
||||
:form => [
|
||||
{
|
||||
:display => '',
|
||||
:null => true,
|
||||
:name => 'geo_ip_backend',
|
||||
:tag => 'select',
|
||||
:options => {
|
||||
'' => '-',
|
||||
'GeoIp::Freegeoip' => 'freegeoip.net',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
:state => 'GeoIp::Freegeoip',
|
||||
:frontend => false
|
||||
)
|
||||
end
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
class UpdateTicketReplace2 < ActiveRecord::Migration
|
||||
def up
|
||||
overview_role = Role.where( :name => 'Agent' ).first
|
||||
if overview_role
|
||||
Overview.destroy_all
|
||||
UserInfo.current_user_id = 1
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'My assigned Tickets',
|
||||
:link => 'my_assigned',
|
||||
:prio => 1000,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
'tickets.state_id' => [ 1,2,3 ],
|
||||
'tickets.owner_id' => 'current_user.id',
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'ASC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'Unassigned & Open Tickets',
|
||||
:link => 'all_unassigned',
|
||||
:prio => 1001,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
'tickets.state_id' => [1,2,3],
|
||||
'tickets.owner_id' => 1,
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'ASC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'All Open Tickets',
|
||||
:link => 'all_open',
|
||||
:prio => 1002,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
'tickets.state_id' => [1,2,3],
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'ASC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'Escalated Tickets',
|
||||
:link => 'all_escalated',
|
||||
:prio => 1010,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
'tickets.escalation_time' =>{ 'direction' => 'before', 'count'=> 5, 'area' => 'minute' },
|
||||
},
|
||||
:order => {
|
||||
:by => 'escalation_time',
|
||||
:direction => 'ASC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'group', 'owner', 'escalation_time' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
|
||||
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'My pending reached Tickets',
|
||||
:link => 'my_pending_reached',
|
||||
:prio => 1020,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
'tickets.state_id' => [3],
|
||||
'tickets.owner_id' => 'current_user.id',
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'ASC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'All Tickets',
|
||||
:link => 'all',
|
||||
:prio => 9003,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
# 'tickets.state_id' => [3],
|
||||
# 'tickets.owner_id' => current_user.id,
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'ASC',
|
||||
},
|
||||
:view => {
|
||||
:s => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
|
||||
overview_role = Role.where( :name => 'Customer' ).first
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'My Tickets',
|
||||
:link => 'my_tickets',
|
||||
:prio => 1000,
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
'tickets.state_id' => [ 1,2,3,4,6 ],
|
||||
'tickets.customer_id' => 'current_user.id',
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'DESC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'state', 'priority', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
Overview.create_if_not_exists(
|
||||
:name => 'My Organization Tickets',
|
||||
:link => 'my_organization_tickets',
|
||||
:prio => 1100,
|
||||
:role_id => overview_role.id,
|
||||
:organization_shared => true,
|
||||
:condition => {
|
||||
'tickets.state_id' => [ 1,2,3,4,6 ],
|
||||
'tickets.organization_id' => 'current_user.organization_id',
|
||||
},
|
||||
:order => {
|
||||
:by => 'created_at',
|
||||
:direction => 'DESC',
|
||||
},
|
||||
:view => {
|
||||
:d => [ 'title', 'customer', 'state', 'created_at' ],
|
||||
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'created_at' ],
|
||||
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
|
||||
:view_mode_default => 's',
|
||||
},
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue