Sha256: 71d2568a3ad75931504c9b48dcd598ec9ac32f10900f06973049c6c589ec97e3

Contents?: true

Size: 1.63 KB

Versions: 17

Compression:

Stored size: 1.63 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 :valid_from, null: false
      t.date :valid_to, null: false
      t.float :status, null: false, default: 0
      t.boolean :primary, null: false, default: false
      t.integer :margin, null: false
      t.references :product,
                   null: false,
                   index: {name: "product_on_ccmp_indx"},
                   foreign_key: {to_table: :comee_core_products}
      t.references :supplier,
                   null: false,
                   index: {name: "supplier_on_ccmp_indx"},
                   foreign_key: {to_table: :comee_core_suppliers}
      t.references :unit,
                   null: false,
                   index: {name: "unit_on_ccmp_indx"},
                   foreign_key: {to_table: :comee_core_units}
      t.references :previous_price,
                   null: true,
                   index: {name: "previous_price_on_ccsp_indx"},
                   foreign_key: {to_table: :comee_core_master_prices}
      t.references :next_price,
                   null: true,
                   index: {name: "next_price_on_ccsp_indx"},
                   foreign_key: {to_table: :comee_core_master_prices}
      t.boolean :propagated_to_client, null: false, default: false

      t.timestamps
    end

    add_index :comee_core_master_prices,
              %i[product_id supplier_id previous_price_id next_price_id status],
              unique: true,
              name: "pi_si_ppi_on_ccmp_indx"
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
comee_core-0.1.53 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.52 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.51 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.50 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.49 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.48 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.47 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.46 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.45 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.45.pre3 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.45.pre2 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.45.pre db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.44 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.43 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.42 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.41 db/migrate/20230813235946_create_comee_core_master_prices.rb
comee_core-0.1.40 db/migrate/20230813235946_create_comee_core_master_prices.rb