Merged migrations.
This commit is contained in:
parent
c6f160f14d
commit
04c8a6bcf8
6 changed files with 93 additions and 158 deletions
|
@ -190,6 +190,7 @@ class CreateBase < ActiveRecord::Migration
|
|||
add_index :tokens, :user_id
|
||||
add_index :tokens, [:name, :action], unique: true
|
||||
add_index :tokens, :created_at
|
||||
add_index :tokens, :persistent
|
||||
|
||||
create_table :packages do |t|
|
||||
t.string :name, limit: 250, null: false
|
||||
|
@ -396,6 +397,25 @@ class CreateBase < ActiveRecord::Migration
|
|||
t.timestamps
|
||||
end
|
||||
add_index :online_notifications, [:user_id]
|
||||
add_index :online_notifications, [:seen]
|
||||
add_index :online_notifications, [:created_at]
|
||||
add_index :online_notifications, [:updated_at]
|
||||
|
||||
create_table :schedulers do |t|
|
||||
t.column :name, :string, limit: 250, null: false
|
||||
t.column :method, :string, limit: 250, null: false
|
||||
t.column :period, :integer, null: true
|
||||
t.column :running, :integer, null: false, default: false
|
||||
t.column :last_run, :timestamp, null: true
|
||||
t.column :prio, :integer, null: false
|
||||
t.column :pid, :string, limit: 250, null: true
|
||||
t.column :note, :string, limit: 250, null: true
|
||||
t.column :active, :boolean, null: false, default: false
|
||||
t.column :updated_by_id, :integer, null: false
|
||||
t.column :created_by_id, :integer, null: false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :schedulers, [:name], unique: true
|
||||
|
||||
create_table :delayed_jobs, force: true do |t|
|
||||
t.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
require 'scheduler'
|
||||
require 'setting'
|
||||
class SchedulerCreate < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :schedulers do |t|
|
||||
t.column :name, :string, limit: 250, null: false
|
||||
t.column :method, :string, limit: 250, null: false
|
||||
t.column :period, :integer, null: true
|
||||
t.column :running, :integer, null: false, default: false
|
||||
t.column :last_run, :timestamp, null: true
|
||||
t.column :prio, :integer, null: false
|
||||
t.column :pid, :string, limit: 250, null: true
|
||||
t.column :note, :string, limit: 250, null: true
|
||||
t.column :active, :boolean, null: false, default: false
|
||||
t.column :updated_by_id, :integer, null: false
|
||||
t.column :created_by_id, :integer, null: false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :schedulers, [:name], unique: true
|
||||
Scheduler.create_or_update(
|
||||
name: 'Import OTRS diff load',
|
||||
method: 'Import::OTRS.diff_worker',
|
||||
period: 60 * 3,
|
||||
prio: 1,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Check Channels',
|
||||
method: 'Channel.fetch',
|
||||
period: 30,
|
||||
prio: 1,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Generate Session data',
|
||||
method: 'Sessions.jobs',
|
||||
period: 60,
|
||||
prio: 1,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Cleanup expired sessions',
|
||||
method: 'SessionHelper.cleanup_expired',
|
||||
period: 60 * 60 * 12,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :schedulers
|
||||
end
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
class UpdateOverview2 < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
overview_role = Role.where( name: 'Agent' ).first
|
||||
|
||||
return true if !overview_role
|
||||
|
||||
UserInfo.current_user_id = 1
|
||||
Overview.create_or_update(
|
||||
name: 'My assigned Tickets',
|
||||
link: 'my_assigned',
|
||||
prio: 1000,
|
||||
role_id: overview_role.id,
|
||||
condition: {
|
||||
'tickets.state_id' => [ 1, 2, 3, 7 ],
|
||||
'tickets.owner_id' => 'current_user.id',
|
||||
},
|
||||
order: {
|
||||
by: 'created_at',
|
||||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: %w(title customer group created_at),
|
||||
s: %w(title customer group created_at),
|
||||
m: %w(number title customer group created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
class AddCleanup < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
# delete old entries
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old activity stream entries.',
|
||||
method: 'ActivityStream.cleanup',
|
||||
period: 1.day,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old online notification entries.',
|
||||
method: 'OnlineNotification.cleanup',
|
||||
period: 12.hours,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old entries.',
|
||||
method: 'RecentView.cleanup',
|
||||
period: 1.day,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
class UpdateCleanup < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
# delete old entries
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old online notification entries.',
|
||||
method: 'OnlineNotification.cleanup',
|
||||
period: 2.hours,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
add_index :online_notifications, [:seen]
|
||||
add_index :online_notifications, [:created_at]
|
||||
add_index :online_notifications, [:updated_at]
|
||||
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old token entries.',
|
||||
method: 'Token.cleanup',
|
||||
period: 30.days,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
add_index :tokens, :persistent
|
||||
end
|
||||
end
|
74
db/seeds.rb
74
db/seeds.rb
|
@ -1946,13 +1946,85 @@ Network::Item::Comment.create(
|
|||
body: 'Some comment....',
|
||||
)
|
||||
|
||||
Scheduler.create_or_update(
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Process pending tickets',
|
||||
method: 'Ticket.process_pending',
|
||||
period: 60 * 15,
|
||||
prio: 1,
|
||||
active: true,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Import OTRS diff load',
|
||||
method: 'Import::OTRS.diff_worker',
|
||||
period: 60 * 3,
|
||||
prio: 1,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Check Channels',
|
||||
method: 'Channel.fetch',
|
||||
period: 30,
|
||||
prio: 1,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Generate Session data',
|
||||
method: 'Sessions.jobs',
|
||||
period: 60,
|
||||
prio: 1,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Cleanup expired sessions',
|
||||
method: 'SessionHelper.cleanup_expired',
|
||||
period: 60 * 60 * 12,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Delete old activity stream entries.',
|
||||
method: 'ActivityStream.cleanup',
|
||||
period: 1.day,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Delete old entries.',
|
||||
method: 'RecentView.cleanup',
|
||||
period: 1.day,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old online notification entries.',
|
||||
method: 'OnlineNotification.cleanup',
|
||||
period: 2.hours,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_or_update(
|
||||
name: 'Delete old token entries.',
|
||||
method: 'Token.cleanup',
|
||||
period: 30.days,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
|
||||
# install locales and translations
|
||||
Locale.create_if_not_exists(
|
||||
|
|
Loading…
Reference in a new issue