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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/merchant_sidekick/migrations/billing.rb', line 3
def self.up
create_table :line_items do |t|
t.integer "order_id"
t.integer "invoice_id"
t.integer "sellable_id"
t.string "sellable_type"
t.integer "net_cents", :default => 0, :null => false
t.integer "tax_cents", :default => 0, :null => false
t.integer "gross_cents", :default => 0, :null => false
t.string "currency", :default => "USD", :null => false
t.decimal "tax_rate", :precision => 15, :scale => 10, :default => 0.0, :null => false
t.timestamps
end
add_index :line_items, "order_id"
add_index :line_items, "invoice_id"
add_index :line_items, ["sellable_id", "sellable_type"]
create_table :orders do |t|
t.integer "buyer_id"
t.string "buyer_type"
t.integer "seller_id"
t.string "seller_type"
t.integer "invoice_id"
t.integer "net_cents", :default => 0, :null => false
t.integer "tax_cents", :default => 0, :null => false
t.integer "gross_cents", :default => 0, :null => false
t.string "currency", :limit => 3, :default => "USD", :null => false
t.string "type"
t.string "status", :default => "created", :null => false
t.string "number"
t.string "description"
t.datetime "canceled_at"
t.timestamps
end
add_index :orders, ["buyer_id", "buyer_type"]
add_index :orders, ["seller_id", "seller_type"]
add_index :orders, "status"
add_index :orders, "type"
create_table :invoices do |t|
t.integer "buyer_id"
t.string "buyer_type"
t.integer "seller_id"
t.string "seller_type"
t.integer "net_cents", :default => 0, :null => false
t.integer "tax_cents", :default => 0, :null => false
t.integer "gross_cents", :default => 0, :null => false
t.string "currency", :default => "USD", :null => false
t.string "type"
t.string "number"
t.string "status", :default => "pending", :null => false
t.datetime "paid_at"
t.integer "order_id"
t.datetime "authorized_at"
t.timestamps
end
add_index :invoices, ["buyer_id", "buyer_type"]
add_index :invoices, "number"
add_index :invoices, "order_id"
add_index :invoices, ["seller_id", "seller_type"]
add_index :invoices, "type"
create_table :payments do |t|
t.integer "payable_id"
t.string "payable_type"
t.boolean "success"
t.string "reference"
t.string "message"
t.string "action"
t.string "params"
t.boolean "test"
t.integer "cents", :default => 0, :null => false
t.string "currency", :limit => 3, :default => "USD", :null => false
t.integer "position"
t.string "type"
t.string "paypal_account"
t.string "uuid"
t.timestamps
end
add_index :payments, "action"
add_index :payments, ["payable_id", "payable_type"]
add_index :payments, "position"
add_index :payments, "reference"
add_index :payments, "uuid"
end
|