Class: ShopProductHoldModelMigration
- Inherits:
-
Migration
- Object
- Migration
- ShopProductHoldModelMigration
- Defined in:
- lib/migrations/05_shop_product_hold_model.rb
Class Method Summary collapse
Class Method Details
.down(site) ⇒ Object
12 13 14 |
# File 'lib/migrations/05_shop_product_hold_model.rb', line 12 def self.down(site) site.product_holds.destroy end |
.up(site) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/migrations/05_shop_product_hold_model.rb', line 2 def self.up(site) site.records.create_model :product_holds do |product_holds| add_one :product, validations: {required: {}}, index: true add_one :cart, validations: {required: {}}, index: true add_field :quantity, :integer, default: 0, validations: {required: {}} add_field :sold, :boolean, default: false product_holds.record_class_name = 'ProductHold' end end |