Class: Taskr::Models::CreateTaskr

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

Class Method Summary collapse

Class Method Details

.downObject



233
234
235
236
# File 'lib/taskr/models.rb', line 233

def self.down
  drop_table :taskr_task_action_parameters
  drop_table :taskr_tasks
end

.upObject



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/taskr/models.rb', line 196

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