class CreateOrderHistLines < ActiveRecord::Migration[6.0]
  def change
    create_table :order_hist_lines do |t|
      t.string :past_code_client
      t.string :numero_piece
      t.string :numerofacture
      t.string :d_number
      t.integer :position
      t.string :code_article
      t.references :p_product_ref, foreign_key: true
      t.decimal :qte,   :precision => 14,   :scale => 2
      t.decimal :prix_u,   :precision => 14,   :scale => 2
      t.decimal :prix_achat,   :precision => 14,   :scale => 2
      t.decimal :taux_tva,   :precision => 14,   :scale => 2
      t.decimal :remise_1,   :precision => 14,   :scale => 2
      t.decimal :remise_2,   :precision => 14,   :scale => 2
      t.datetime :date_creation
      t.datetime :date_modification
      t.string :compte_vente
      t.date :date_piece
      t.date :date_facture
      t.decimal :colisage,   :precision => 14,   :scale => 2
      t.decimal :nbr_colis,   :precision => 14,   :scale => 2
      t.decimal :taux_com_1,   :precision => 14,   :scale => 2
      t.decimal :colisage_achat,   :precision => 14,   :scale => 2
      t.decimal :prix_achat_brut,   :precision => 14,   :scale => 2
      t.decimal :quantite_origine,   :precision => 14,   :scale => 2
      t.decimal :pu_tarif_origine,   :precision => 14,   :scale => 2
      t.decimal :taux_tva_article_2,   :precision => 14,   :scale => 2
      t.string :compte_ventil_vente
      t.integer :num_ligne_avancement
      t.integer :etat
      t.string :reference_1
      t.string :reference_2
      t.string :reference_3
      t.string :reference_4
      t.string :code_mode_reglement
      t.references :p_payment_type, foreign_key: true
      t.integer :echeance_nbr_jour
      t.date :date_echeance
      t.string :code_commercial
      t.references :p_commercial, foreign_key: true
      t.decimal :taux_escompte,   :precision => 14,   :scale => 2
      t.decimal :taux_remise,   :precision => 14,   :scale => 2
      t.string :fichier_archive
      t.string :interlocuteur
      t.string :new_code_client
      t.references :p_customer, foreign_key: true

      t.timestamps
    end
  end
end
