Class: CreatePayflowSubscriptions

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

Instance Method Summary collapse

Instance Method Details

#changeObject



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

def change
  create_table :payflow_subscriptions do |t|
    t.references :billable, polymorphic: true, null: false, index: true
    t.string :plan, null: false
    t.string :provider, null: false
    t.string :external_id, null: false
    t.string :status, null: false, default: "pending"
    t.datetime :cancelled_at

    t.timestamps
  end

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