Class: Taskr::Models::CreateTaskr

Inherits:
V
  • Object
show all
Defined in:
lib/taskr/models.rb

Class Method Summary collapse

Class Method Details

.downObject



328
329
330
331
# File 'lib/taskr/models.rb', line 328

def self.down
  drop_table :taskr_task_action_parameters
  drop_table :taskr_tasks
end

.upObject



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/taskr/models.rb', line 291

def self.up
  $LOG.info("Migrating database")
  
  create_table :taskr_tasks, :force => true do |t|
    t.column :name, :string, :null => false
    t.column :created_on, :timestamp, :null => false
    t.column :created_by, :string
    
    t.column :schedule_method, :string, :null => false
    t.column :schedule_when, :string, :null => false
    t.column :schedule_options, :text
    
    t.column :scheduler_job_id, :integer
    t.column :last_triggered, :datetime
    t.column :last_triggered_error, :text
  end
  
  add_index :taskr_tasks, [:name], :unique => true
  
  create_table :taskr_task_actions, :force => true do |t|
    t.column :task_id, :integer, :null => false
    t.column :action_class_name, :string, :null => false
    t.column :order, :integer
  end
  
  add_index :taskr_task_actions, [:task_id]
  
  create_table :taskr_task_action_parameters, :force => true do |t|
    t.column :task_action_id, :integer, :null => false
    t.column :name, :string, :null => false
    t.column :value, :text
  end
  
  add_index :taskr_task_action_parameters, [:task_action_id]
  add_index :taskr_task_action_parameters, [:task_action_id, :name]
end