class CreatePProductBrutStocks < ActiveRecord::Migration[6.0]
  def change
    create_table :p_product_brut_stocks do |t|
      t.references   :p_brut_product,   index: true
      t.references   :p_fournisseur_order,   index: true
      t.references   :p_tank,   index: true
      t.decimal      :qte,   :precision => 14,   :scale => 2
      t.decimal      :price,   :precision => 14,   :scale => 2
      t.datetime     :ok_at
      t.decimal      :ok_qte,   :precision => 14,   :scale => 2
      t.decimal      :ok_price,   :precision => 14,   :scale => 2
      t.decimal      :ok_price_abs,   :precision => 14,   :scale => 2
      t.decimal      :price_abs,   :precision => 14,   :scale => 2
      t.boolean      :ok,   :default => false
      t.decimal      :qte_restant,   :precision => 14,   :scale => 2,   :default => 0.00
      t.boolean      :lock,   :default => false
      t.string       :stock_type
      t.boolean      :externe,   :default => false
      t.boolean      :comptabilised,   :default => false

      t.timestamps
    end
  end
end
