class CreateVirements < ActiveRecord::Migration
  def change
    create_table :virements do |t|
      t.string :token
      t.integer :virement_type_id
      t.boolean :sended
      t.boolean :confirmed
      t.boolean :done
      t.string :note
      t.references :annonce_account, index: true
      t.references :virement_remise, index: true
      t.decimal :amount_ht, :precision => 10, :scale => 2
      t.decimal :amount_ttc, :precision => 10, :scale => 2
      t.decimal :tva, :precision => 10, :scale => 2
      t.decimal :frais
      t.decimal :solde
      t.references :commission, index: true
      t.references :annonce_account_rib, index: true

      t.timestamps null: false
    end
    add_foreign_key :virements, :annonce_accounts
    add_foreign_key :virements, :virement_remises
    add_foreign_key :virements, :commissions
    add_foreign_key :virements, :annonce_account_ribs
  end
end
