Class: CreateGimmeGimmeTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/gimme_gimme/install/templates/create_gimme_gimme_tables.rb

Class Method Summary collapse

Class Method Details

.downObject



22
23
24
25
26
27
28
# File 'lib/generators/gimme_gimme/install/templates/create_gimme_gimme_tables.rb', line 22

def self.down
  remove_table :credit_cards
  change_table :users do |t|
    t.remove   :remote_customer_profile_id
    t.remove   :customer_key
  end
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/gimme_gimme/install/templates/create_gimme_gimme_tables.rb', line 2

def self.up
  create_table :credit_cards do |t|
    t.integer :user_id,                                         :null => false
    t.string  :first_name,                                      :null => false
    t.string  :last_name,                                       :null => false
    t.string  :remote_customer_payment_profile_id,              :null => false
    t.integer :expiration_month,                                :null => false
    t.integer :expiration_year,                                 :null => false
    t.string  :last_four_digits,                                :limit => 4
    t.string  :card_type,                                       :null => false

    t.timestamps
  end

  change_table :users do |t|
    t.string   :remote_customer_profile_id
    t.string   :customer_key
  end
end