Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AddOnlineOrderNewColumns < ActiveRecord::Migration
- def up
- add_column "bill.online_orders", :is_payed, :boolean, null: false, default: false
- add_column "bill.online_orders", :payment_system_id, :uuid, null: true
- add_column "bill.online_orders", :payment_system_class, :string, null: true
- add_column "bill.online_orders", :payed_amount, :decimal, precision: 20, scale: 4, default: 0, null: false
- add_column "bill.online_orders", :is_delivery_in_cash, :boolean, null: false, default: false
- add_column "restaurant.restaurant_settings", :is_delivery_in_cash, :boolean, null: false, default: true
- add_column "bill.bills", :delivery_amount, :decimal, precision: 20, scale: 4, default: 0, null: false
- Restaurant.all.each do |r|
- pay_type = LocalRestaurant::PayType.new
- pay_type.restaurant_id = r.id
- pay_type.name = 'online'
- pay_type.save
- end
- end
- def down
- remove_column "bill.online_orders", :is_payed, :payment_system_id, :payment_system_class, :payed_amount, :is_delivery_in_cash
- remove_column "restaurant.restaurant_settings", :is_delivery_in_cash
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment