Sha256: a71a6b0efcffcb9b5420aa7bf80842845451bfbb9c0823e44fee88c5cfd6ddcf

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
  def change
    create_table :comee_core_master_prices do |t|
      t.float :purchase_price, null: false
      t.float :selling_price, null: false
      t.date :pp_valid_from, null: false
      t.date :pp_valid_to, null: false
      t.date :sp_valid_from, null: false
      t.date :sp_valid_to, null: false
      t.boolean :active, null: false
      t.boolean :primary, null: false
      t.integer :margin, null: false
      t.references :product,
        null: false,
        index: {name: "product_on_ccsp_indx"},
        foreign_key: {to_table: :comee_core_products}
      t.references :supplier,
        null: false,
        index: {name: "supplier_on_ccsp_indx"},
        foreign_key: {to_table: :comee_core_suppliers}
      t.references :previous_price,
        null: true,
        index: {name: "previous_price_on_ccsp_indx"},
        foreign_key: {to_table: :comee_core_master_prices}

      t.timestamps
    end
    add_index :comee_core_master_prices, [:product_id, :supplier_id], unique: true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comee_core-0.1.15 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.14 db/migrate/20230813235946_create_comee_core_master_prices.rb