5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/generators/say_when/migration/templates/migration.rb', line 5
def self.up
create_table :say_when_jobs, :force => true do |t|
t.string :group
t.string :name
t.string :status
t.string :trigger_strategy
t.text :trigger_options
t.timestamp :last_fire_at
t.timestamp :next_fire_at
t.timestamp :start_at
t.timestamp :end_at
t.string :job_class
t.string :job_method
t.text :data
t.string :scheduled_type
t.integer :scheduled_id
t.timestamps null: false
end
add_index :say_when_jobs, [:next_fire_at, :status]
add_index :say_when_jobs, [:scheduled_type, :scheduled_id]
create_table :say_when_job_executions, :force => true do |t|
t.integer :job_id
t.string :status
t.text :result
t.datetime :start_at
t.datetime :end_at
end
add_index :say_when_job_executions, :job_id
add_index :say_when_job_executions, [:status, :start_at, :end_at]
end
|