20141221000001_create_job.rb 1.2 KB

12345678910111213141516171819202122232425
  1. class CreateJob < ActiveRecord::Migration
  2. def up
  3. create_table :jobs do |t|
  4. t.column :name, :string, limit: 250, null: false
  5. t.column :timeplan, :string, limit: 500, null: false
  6. t.column :condition, :string, limit: 2500, null: false
  7. t.column :execute, :string, limit: 2500, null: false
  8. t.column :last_run_at, :timestamp, null: true
  9. t.column :running, :boolean, null: false, default: false
  10. t.column :processed, :integer, null: false, default: 0
  11. t.column :matching, :integer, null: false
  12. t.column :pid, :string, limit: 250, null: true
  13. t.column :note, :string, limit: 250, null: true
  14. t.column :active, :boolean, null: false, default: false
  15. t.column :updated_by_id, :integer, null: false
  16. t.column :created_by_id, :integer, null: false
  17. t.timestamps null: false
  18. end
  19. add_index :jobs, [:name], unique: true
  20. end
  21. def down
  22. drop_table :jobs
  23. end
  24. end