Upgraded Rails and RSpec
[monkeycharger.git] / db / migrate / 002_add_tables_for_capture_refund_void_and_authorizations.rb
blob107d8dcb2f7e14357856ebabdc1b6c2ea567e5b4
1 class AddTablesForCaptureRefundVoidAndAuthorizations < ActiveRecord::Migration
2   def self.up
4     create_table :authorizations do |t|
5       integer     :credit_card_id
6       integer     :transaction_id,  :null => false
7       string      :last_four_digits, :null => false
8       decimal     :amount,          :null => false
9       timestamps!
10     end
12     create_table :captures do |t|
13       foreign_key :authorization, :ref => true
14       integer     :transaction_id, :null => false
15       decimal     :amount, :null => false
16       timestamps!
17     end
19     create_table :refunds do |t|
20       foreign_key :authorization,   :ref => true
21       integer     :transaction_id,  :null => false
22       decimal     :amount,          :null => false
23       timestamps!
24     end
26     create_table :voids do |t|
27       integer :voidee_id,       :null => false
28       string  :voidee_type,     :null => false
29       integer :transaction_id,  :null => false
30       timestamps!
31     end
33   end
35   def self.down
36     drop_table :captures
37     drop_table :refunds
38     drop_table :voids
39     drop_table :authorizations
40   end
41 end