class CreatePSheetLines < ActiveRecord::Migration[6.0]
  def change
    create_table :p_sheet_lines do |t|
      t.references   :p_customer_sheet,   index: true
      t.references   :p_product,   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.boolean      :ok,   :default => false
      t.boolean      :lock,   :default => false
      t.boolean      :externe,   :default => false
      t.integer      :externe_stock_id
      t.references   :p_document,   index: true
      t.boolean      :shiped,   :default => false
      t.boolean      :bl,   :default => false
      t.boolean      :ship,   :default => false
      t.integer      :p_ship_tour_truck_sheet_line_id
      t.boolean      :stock_done,   :default => false
      t.decimal      :a_total_cost_ok,   :precision => 14,   :scale => 2
      t.string       :ref
      t.decimal      :price_tot,   :precision => 14,   :scale => 2
      t.decimal      :price_tot_ttc,   :precision => 14,   :scale => 2
      t.decimal      :ok_price_tot,   :precision => 14,   :scale => 2
      t.decimal      :ok_price_tot_ttc,   :precision => 14,   :scale => 2
      t.boolean      :imported,   :default => false
      t.string       :piece
      t.boolean      :arrondi,   :default => false
      t.boolean      :decr,   :default => false
      t.string       :custom_title
      t.text         :custom_desc
      t.boolean      :no_stock,   :default => false
      t.boolean      :custom,   :default => false
      t.string       :element_label
      t.boolean      :cancel,   :default => false

      t.timestamps
    end
  end
end
