Class: Taskr::Models::CreateTaskr

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

Class Method Summary collapse

Class Method Details

.downObject



398
399
400
401
# File 'lib/taskr/models.rb', line 398

def self.down
  drop_table :taskr_task_action_parameters
  drop_table :taskr_tasks
end

.upObject



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/taskr/models.rb', line 361

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