Sha256: 8aff815870ac0c3dc1e902eb5f025ea80bface345072a01c233b27ccaea0cbee

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

class CreateUnidomShoppingItems < ActiveRecord::Migration[6.0]

  def change

    create_table :unidom_shopping_items, id: :uuid do |t|

      t.references :shopping_cart, type: :uuid, null: false
      t.references :shopper, type: :uuid, null: false,
        polymorphic: { null: false, default: '', limit: 200 }
      t.references :shopped, type: :uuid, null: false,
        polymorphic: { null: false, default: '', limit: 200 }

      t.decimal :unit_price, null: false, default: 0.0, precision: 12, scale: 2
      t.decimal :quantity,   null: false, default: 0.0, precision: 12, scale: 2

      t.column   :state, 'char(1)', null: false, default: Unidom::Common::STATE
      t.datetime :opened_at,        null: false, default: Unidom::Common::OPENED_AT
      t.datetime :closed_at,        null: false, default: Unidom::Common::CLOSED_AT
      t.boolean  :defunct,          null: false, default: false
      t.jsonb    :notation,         null: false, default: {}

      t.timestamps null: false

    end

    #add_index :unidom_shopping_items, :shopping_cart_id
    add_index :unidom_shopping_items, :shopper_id
    add_index :unidom_shopping_items, :shopped_id

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-shopping-2.0.1 db/migrate/20020502000000_create_unidom_shopping_items.rb