Class: CreateBookings

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/bookings/generators/templates/bookings_migration.rb

Class Method Summary collapse

Class Method Details

.downObject



23
24
25
# File 'lib/bookings/generators/templates/bookings_migration.rb', line 23

def self.down
  drop_table :bookings
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bookings/generators/templates/bookings_migration.rb', line 2

def self.up
  create_table :bookings do |t|
    t.column :bookable_id,      :integer
    t.column :bookable_type,    :string
    t.column :name,             :string
    t.column :summary,          :text
    t.column :terms,            :text
    t.column :starts_at,        :datetime
    t.column :ends_at,          :datetime
    t.column :booked_at,        :datetime
    t.column :cancelled_at,     :datetime
    t.column :paid_at,          :datetime
    t.column :payment_type,     :string
    t.column :requested_amount, :decimal
    t.column :confirmed_amount, :decimal
    t.column :booking_state,    :string
  end

  add_index :bookings, [:bookable_id, :bookable_type]
end