class CreateMOdrVirements < ActiveRecord::Migration[6.0]
  def change
    create_table :m_odr_virements do |t|
      t.references :m_odr, foreign_key: true
      t.references :m_odr_rep, foreign_key: true
      t.references :m_odr_rep_rib, foreign_key: true
      t.boolean :enabled, :default => false
      t.boolean :sended, :default => false
      t.boolean :refused, :default => false
      t.string :reject_reason
      t.text :reject_reason_description
      t.decimal :cc_remise,   :precision => 14,   :scale => 2
      t.decimal :ac_remise,   :precision => 14,   :scale => 2
      
      t.decimal :amount,      :precision => 14,   :scale => 2
      
      t.string :cc_iban_to
      t.string :ac_iban_to
      t.string :cc_bic_to
      t.string :ac_bic_to
      
      t.integer :m_odr_remise_id
      t.integer :m_odr_bank_account_id
      
      t.string :cc_iban_from
      t.string :ac_iban_from
      t.string :cc_bic_from
      t.string :ac_bic_from
      
      t.string :cc_bank_name
      t.string :ac_bank_name
      
      t.string :cc_bank_subject
      t.string :ac_bank_subject
      
      t.string :cc_libelle
      t.string :ac_libelle
      
      t.datetime :send_at
      
      t.datetime :confirmed_at
      
      t.string :token
       
      t.timestamps
    end
  end
end
