Class: ActsAsWorkingDaysMigration

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/acts_as_working_days/migration/templates/active_record/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



20
21
22
23
# File 'lib/generators/acts_as_working_days/migration/templates/active_record/migration.rb', line 20

def self.down
  drop_table :working_days
  remove_index :working_days, [:workable_id, :workable_type]
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/acts_as_working_days/migration/templates/active_record/migration.rb', line 3

def self.up
  create_table :working_days, :force => true do |t|
    #Date time columns
    t.integer :week_day
    t.integer :start_hour, :default => 0
    t.integer :start_min, :default => 0
    t.integer :end_hour, :default => 23
    t.integer :end_min, :default => 59
    #Polymorphic columns
    t.integer :workable_id
    t.string :workable_type
    
    t.timestamps
  end
  add_index :working_days, [:workable_id, :workable_type]
end