1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* PayPal Donation extension for the phpBB Forum Software package. |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2015-2020 Skouat |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace skouat\ppde\migrations\v31x; |
12
|
|
|
|
13
|
|
|
class v310_m1_schema extends \phpbb\db\migration\migration |
14
|
|
|
{ |
15
|
|
|
public static function depends_on() |
16
|
|
|
{ |
17
|
|
|
return ['\skouat\ppde\migrations\v30x\v300_m1_converter_data']; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Add the table schema to the database: |
22
|
|
|
* |
23
|
|
|
* @return array Array of table schema |
24
|
|
|
* @access public |
25
|
|
|
*/ |
26
|
|
|
public function update_schema() |
27
|
|
|
{ |
28
|
|
|
return [ |
29
|
|
|
'add_tables' => [ |
30
|
|
|
$this->table_prefix . 'ppde_currency' => [ |
31
|
|
|
'COLUMNS' => [ |
32
|
|
|
'currency_id' => ['UINT', null, 'auto_increment'], |
33
|
|
|
'currency_name' => ['VCHAR:50', ''], |
34
|
|
|
'currency_iso_code' => ['VCHAR:10', ''], |
35
|
|
|
'currency_symbol' => ['VCHAR:10', ''], |
36
|
|
|
'currency_on_left' => ['BOOL', 1], |
37
|
|
|
'currency_enable' => ['BOOL', 1], |
38
|
|
|
'currency_order' => ['UINT', 0], |
39
|
|
|
], |
40
|
|
|
'PRIMARY_KEY' => ['currency_id'], |
41
|
|
|
], |
42
|
|
|
|
43
|
|
|
$this->table_prefix . 'ppde_donation_pages' => [ |
44
|
|
|
'COLUMNS' => [ |
45
|
|
|
'page_id' => ['UINT', null, 'auto_increment'], |
46
|
|
|
'page_title' => ['VCHAR:50', ''], |
47
|
|
|
'page_lang_id' => ['UINT', 0], |
48
|
|
|
'page_content' => ['TEXT', ''], |
49
|
|
|
'page_content_bbcode_bitfield' => ['VCHAR:255', ''], |
50
|
|
|
'page_content_bbcode_uid' => ['VCHAR:8', ''], |
51
|
|
|
'page_content_bbcode_options' => ['UINT:4', 7], |
52
|
|
|
], |
53
|
|
|
|
54
|
|
|
'PRIMARY_KEY' => ['page_id'], |
55
|
|
|
], |
56
|
|
|
|
57
|
|
|
$this->table_prefix . 'ppde_txn_log' => [ |
58
|
|
|
'COLUMNS' => [ |
59
|
|
|
'transaction_id' => ['UINT', null, 'auto_increment'], |
60
|
|
|
// Receiver information |
61
|
|
|
'receiver_id' => ['VCHAR:13', ''], |
62
|
|
|
'receiver_email' => ['VCHAR:127', ''], |
63
|
|
|
'residence_country' => ['VCHAR:2', ''], |
64
|
|
|
'business' => ['VCHAR:127', ''], |
65
|
|
|
// Transaction information |
66
|
|
|
'confirmed' => ['BOOL', 0], |
67
|
|
|
'test_ipn' => ['BOOL', 0], |
68
|
|
|
'txn_id' => ['VCHAR:32', ''], |
69
|
|
|
'txn_type' => ['VCHAR:32', ''], |
70
|
|
|
'parent_txn_id' => ['VCHAR:19', ''], |
71
|
|
|
// Buyer information |
72
|
|
|
'payer_email' => ['VCHAR:127', ''], |
73
|
|
|
'payer_id' => ['VCHAR:13', ''], |
74
|
|
|
'payer_status' => ['VCHAR:16', ''], |
75
|
|
|
'first_name' => ['VCHAR:64', ''], |
76
|
|
|
'last_name' => ['VCHAR:64', ''], |
77
|
|
|
'user_id' => ['UINT', 0], |
78
|
|
|
// Payment information |
79
|
|
|
'custom' => ['VCHAR:255', ''], |
80
|
|
|
'item_name' => ['VCHAR:128', ''], |
81
|
|
|
'item_number' => ['VCHAR:128', ''], |
82
|
|
|
'mc_currency' => ['VCHAR:8', ''], |
83
|
|
|
'mc_fee' => ['DECIMAL:8', 0], |
84
|
|
|
'mc_gross' => ['DECIMAL:8', 0], |
85
|
|
|
'payment_date' => ['TIMESTAMP', 0], |
86
|
|
|
'payment_status' => ['VCHAR:18', ''], |
87
|
|
|
'payment_type' => ['VCHAR:10', ''], |
88
|
|
|
'settle_amount' => ['DECIMAL:8', 0], |
89
|
|
|
'settle_currency' => ['VCHAR:8', ''], |
90
|
|
|
'net_amount' => ['DECIMAL:8', 0], |
91
|
|
|
'exchange_rate' => ['VCHAR:16', ''], |
92
|
|
|
], |
93
|
|
|
|
94
|
|
|
'PRIMARY_KEY' => ['transaction_id'], |
95
|
|
|
'KEYS' => [ |
96
|
|
|
'user_id' => ['INDEX', 'user_id'], |
97
|
|
|
'txn_id' => ['INDEX', 'txn_id'], |
98
|
|
|
], |
99
|
|
|
], |
100
|
|
|
], |
101
|
|
|
]; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Drop the PayPal Donation tables schema from the database |
106
|
|
|
* |
107
|
|
|
* @return array Array of table schema |
108
|
|
|
* @access public |
109
|
|
|
*/ |
110
|
|
|
public function revert_schema() |
111
|
|
|
{ |
112
|
|
|
return [ |
113
|
|
|
'drop_tables' => [ |
114
|
|
|
$this->table_prefix . 'ppde_currency', |
115
|
|
|
$this->table_prefix . 'ppde_donation_pages', |
116
|
|
|
$this->table_prefix . 'ppde_txn_log', |
117
|
|
|
], |
118
|
|
|
]; |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|