Class: CreateSubscriptionFuTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/subscription_fu/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



39
40
41
42
43
# File 'lib/generators/subscription_fu/templates/migration.rb', line 39

def self.down
  drop_table "subscriptions"
  drop_table "subscription_transactions"
  drop_table "subscription_system_initiators"
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/subscription_fu/templates/migration.rb', line 2

def self.up
  create_table "subscriptions", :force => true do |t|
    t.references "subject",          :polymorphic => true
    t.references "prev_subscription"
    t.string     "plan_key",         :limit => 10, :null => false
    t.boolean    "sponsored",                      :null => false, :default => false
    t.string     "paypal_profile_id"
    t.datetime   "starts_at",                      :null => false
    t.datetime   "billing_starts_at",              :null => false
    t.datetime   "activated_at"
    t.datetime   "canceled_at"
    t.string     "cancel_reason",     :limit => 10
    t.timestamps
  end

  add_index "subscriptions", ["subject_id", "subject_type"]

  create_table "subscription_transactions" do |t|
    t.references "subscription",                 :null => false
    t.references "initiator",                    :null => false, :polymorphic => true
    t.string     "action",         :limit => 15, :null => false
    t.string     "status",         :limit => 15, :null => false
    t.string     "gateway",        :limit => 10, :null => false
    t.string     "identifier"
    t.references "related_transaction"
    t.timestamps
  end

  add_index "subscription_transactions", ["identifier"]
  add_index "subscription_transactions", ["subscription_id"]

  create_table "subscription_system_initiators" do |t|
    t.string "name"
    t.string "description"
  end
end