Class: CreatePayflowInvoices

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/payflow/templates/migration_invoice.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/payflow/templates/migration_invoice.rb', line 2

def change
  create_table :payflow_invoices do |t|
    t.references :subscription, null: false, foreign_key: { to_table: :payflow_subscriptions }
    t.string :external_id, null: false
    t.string :status, null: false, default: "pending"
    t.decimal :amount, precision: 10, scale: 2
    t.datetime :due_date

    t.timestamps
  end

  add_index :payflow_invoices, :external_id, unique: true
  add_index :payflow_invoices, :status
end