20150968000001_create_calendar.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. class CreateCalendar < ActiveRecord::Migration
  2. def up
  3. create_table :calendars do |t|
  4. t.string :name, limit: 250, null: true
  5. t.string :timezone, limit: 250, null: true
  6. t.string :business_hours, limit: 1200, null: true
  7. t.boolean :default, null: false, default: false
  8. t.string :ical_url, limit: 500, null: true
  9. t.text :public_holidays, limit: 500.kilobytes + 1, null: true
  10. t.text :last_log, limit: 500.kilobytes + 1, null: true
  11. t.timestamp :last_sync, null: true
  12. t.integer :updated_by_id, null: false
  13. t.integer :created_by_id, null: false
  14. t.timestamps null: false
  15. end
  16. add_index :calendars, [:name], unique: true
  17. Scheduler.create_or_update(
  18. name: 'Sync calendars with ical feeds.',
  19. method: 'Calendar.sync',
  20. period: 1.day,
  21. prio: 2,
  22. active: true,
  23. updated_by_id: 1,
  24. created_by_id: 1,
  25. )
  26. end
  27. def down
  28. drop_table :calendars
  29. end
  30. end