Class: Taskr::Models::CreateTaskr

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

Class Method Summary collapse

Class Method Details

.downObject



349
350
351
352
# File 'lib/taskr/models.rb', line 349

def self.down
  drop_table :taskr_task_action_parameters
  drop_table :taskr_tasks
end

.upObject



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/taskr/models.rb', line 312

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