Files
sx-fc/db/migrate/20170404034234_create_bookings.rb
2018-07-06 11:55:22 +06:30

23 lines
934 B
Ruby
Executable File

class CreateBookings < ActiveRecord::Migration[5.1]
def change
create_table :bookings, :id => false do |t|
t.string :booking_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
t.references :dining_facility, foreign_key: true
t.string :type, :null => false, :default => "Table"
t.datetime :checkin_at, :index => true, :null => false
t.string :checkin_by
t.datetime :checkout_at
t.string :checkout_by, :index => true
t.datetime :reserved_at
t.string :reserved_by, :index => true
t.string :booking_status, :index => true, :null => false, :default => "new"
t.string :sale_id, foreign_key: true, :limit => 16
t.string :customer_id, foreign_key: true, :limit => 16
t.timestamps
end
add_index :bookings, [:checkin_at, :checkout_by, :reserved_by, :booking_status], name: 'index_bookings'
end
end