class CreatePPayments < ActiveRecord::Migration[6.0]
  def change
    create_table :p_payments do |t|
      t.datetime     :paid_at
      t.datetime     :theo_date
      t.references   :p_payment_type,   index: true
      t.decimal      :amount,   :precision => 14,   :scale => 2
      t.string       :number
      t.references   :p_customer,   index: true
      t.boolean      :paid,   :default => false
      t.boolean      :canceled,   :default => false
      t.boolean      :affected,   :default => false
      t.references   :p_ship_tour_truck_sheet_line,   index: true
      t.references   :p_sheet_line,   index: true
      t.boolean      :imported,   :default => false
      t.string       :label
      t.string       :piece
      t.boolean      :i_archive,   :default => false
      t.boolean      :remise,   :default => false
      t.references   :p_remise,   index: true
      t.boolean      :i_ajust,   :default => false
      t.boolean      :i_ajust_result,   :default => false
      t.date         :received_at
      t.date         :past_paid_at
      t.date         :past_theo_date
      t.boolean      :past_diff,   :default => false
      t.references   :p_bank_account,   index: true
      t.integer      :p_compta_export_id
      t.boolean      :compta_locked,   :default => false

      t.timestamps
    end
  end
end
