| 1 |
<?php |
| 2 |
/** |
| 3 |
* Transactions: BerlinDB database schema |
| 4 |
* |
| 5 |
* @package SimplePay |
| 6 |
* @subpackage Core |
| 7 |
* @copyright Copyright (c) 2022, Sandhills Development, LLC |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 4.4.6 |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace SimplePay\Core\Transaction\Database; |
| 13 |
|
| 14 |
use SimplePay\Vendor\BerlinDB\Database\Schema as BerlinDBSchema; |
| 15 |
|
| 16 |
/** |
| 17 |
* Schema class. |
| 18 |
* |
| 19 |
* @since 4.4.6 |
| 20 |
*/ |
| 21 |
class Schema extends BerlinDBSchema { |
| 22 |
|
| 23 |
/** |
| 24 |
* {@inheritdoc} |
| 25 |
* |
| 26 |
* @var array<int, array<string, bool|int|string|null>> |
| 27 |
*/ |
| 28 |
public $columns = array( |
| 29 |
|
| 30 |
// id. |
| 31 |
array( |
| 32 |
'name' => 'id', |
| 33 |
'type' => 'bigint', |
| 34 |
'length' => '20', |
| 35 |
'unsigned' => true, |
| 36 |
'extra' => 'auto_increment', |
| 37 |
'primary' => true, |
| 38 |
'sortable' => true, |
| 39 |
'validate' => 'intval', |
| 40 |
), |
| 41 |
|
| 42 |
// form_id. |
| 43 |
array( |
| 44 |
'name' => 'form_id', |
| 45 |
'type' => 'bigint', |
| 46 |
'length' => '20', |
| 47 |
'allow_null' => false, |
| 48 |
'validate' => 'intval', |
| 49 |
), |
| 50 |
|
| 51 |
// object. |
| 52 |
array( |
| 53 |
'name' => 'object', |
| 54 |
'type' => 'varchar', |
| 55 |
'length' => '100', |
| 56 |
'allow_null' => false, |
| 57 |
'validate' => 'sanitize_text_field', |
| 58 |
), |
| 59 |
|
| 60 |
// _object_id - prefixed with a _ to bypass a reserved column format that is defaulted |
| 61 |
// to when BerlinDB calls $wpdb::insert( $table, $data, $format ); without a format. |
| 62 |
array( |
| 63 |
'name' => '_object_id', |
| 64 |
'type' => 'varchar', |
| 65 |
'length' => '255', |
| 66 |
'default' => null, |
| 67 |
'allow_null' => true, |
| 68 |
'validate' => 'sanitize_text_field', |
| 69 |
), |
| 70 |
|
| 71 |
// amount_total. |
| 72 |
array( |
| 73 |
'name' => 'amount_total', |
| 74 |
'type' => 'bigint', |
| 75 |
'length' => '20', |
| 76 |
'allow_null' => false, |
| 77 |
'validate' => 'intval', |
| 78 |
), |
| 79 |
|
| 80 |
// amount_subtotal. |
| 81 |
array( |
| 82 |
'name' => 'amount_subtotal', |
| 83 |
'type' => 'bigint', |
| 84 |
'length' => '20', |
| 85 |
'allow_null' => false, |
| 86 |
'validate' => 'intval', |
| 87 |
), |
| 88 |
|
| 89 |
// amount_shipping. |
| 90 |
array( |
| 91 |
'name' => 'amount_shipping', |
| 92 |
'type' => 'bigint', |
| 93 |
'length' => '20', |
| 94 |
'allow_null' => false, |
| 95 |
'validate' => 'intval', |
| 96 |
), |
| 97 |
|
| 98 |
// amount_discount. |
| 99 |
array( |
| 100 |
'name' => 'amount_discount', |
| 101 |
'type' => 'bigint', |
| 102 |
'length' => '20', |
| 103 |
'allow_null' => false, |
| 104 |
'validate' => 'intval', |
| 105 |
), |
| 106 |
|
| 107 |
// amount_refunded. |
| 108 |
array( |
| 109 |
'name' => 'amount_refunded', |
| 110 |
'type' => 'bigint', |
| 111 |
'length' => '20', |
| 112 |
'default' => 0, |
| 113 |
'allow_null' => false, |
| 114 |
'validate' => 'intval', |
| 115 |
), |
| 116 |
|
| 117 |
// amount_tax. |
| 118 |
array( |
| 119 |
'name' => 'amount_tax', |
| 120 |
'type' => 'bigint', |
| 121 |
'length' => '20', |
| 122 |
'allow_null' => false, |
| 123 |
'validate' => 'intval', |
| 124 |
), |
| 125 |
|
| 126 |
// currency. |
| 127 |
array( |
| 128 |
'name' => 'currency', |
| 129 |
'type' => 'varchar', |
| 130 |
'length' => '3', |
| 131 |
'allow_null' => false, |
| 132 |
'validate' => 'sanitize_text_field', |
| 133 |
), |
| 134 |
|
| 135 |
// payment_method_type. |
| 136 |
array( |
| 137 |
'name' => 'payment_method_type', |
| 138 |
'type' => 'varchar', |
| 139 |
'length' => '50', |
| 140 |
'allow_null' => true, |
| 141 |
'validate' => 'sanitize_text_field', |
| 142 |
), |
| 143 |
|
| 144 |
// livemode. |
| 145 |
array( |
| 146 |
'name' => 'livemode', |
| 147 |
'type' => 'tinyint', |
| 148 |
'length' => '1', |
| 149 |
'allow_null' => false, |
| 150 |
'validate' => 'intval', |
| 151 |
), |
| 152 |
|
| 153 |
// email. |
| 154 |
array( |
| 155 |
'name' => 'email', |
| 156 |
'type' => 'varchar', |
| 157 |
'length' => '255', |
| 158 |
'default' => null, |
| 159 |
'allow_null' => true, |
| 160 |
'validate' => 'sanitize_text_field', |
| 161 |
), |
| 162 |
|
| 163 |
// customer_id. |
| 164 |
array( |
| 165 |
'name' => 'customer_id', |
| 166 |
'type' => 'varchar', |
| 167 |
'length' => '255', |
| 168 |
'default' => null, |
| 169 |
'allow_null' => true, |
| 170 |
'validate' => 'sanitize_text_field', |
| 171 |
), |
| 172 |
|
| 173 |
// subscription_id. |
| 174 |
array( |
| 175 |
'name' => 'subscription_id', |
| 176 |
'type' => 'varchar', |
| 177 |
'length' => '255', |
| 178 |
'default' => null, |
| 179 |
'allow_null' => true, |
| 180 |
'validate' => 'sanitize_text_field', |
| 181 |
), |
| 182 |
|
| 183 |
// status. |
| 184 |
array( |
| 185 |
'name' => 'status', |
| 186 |
'type' => 'varchar', |
| 187 |
'length' => '50', |
| 188 |
'allow_null' => false, |
| 189 |
'validate' => 'sanitize_text_field', |
| 190 |
), |
| 191 |
|
| 192 |
// application_fee. |
| 193 |
array( |
| 194 |
'name' => 'application_fee', |
| 195 |
'type' => 'tinyint', |
| 196 |
'length' => '1', |
| 197 |
'allow_null' => false, |
| 198 |
'validate' => 'intval', |
| 199 |
), |
| 200 |
|
| 201 |
// ip_address. |
| 202 |
array( |
| 203 |
'name' => 'ip_address', |
| 204 |
'type' => 'varchar', |
| 205 |
'length' => '128', |
| 206 |
'allow_null' => false, |
| 207 |
'validate' => 'sanitize_text_field', |
| 208 |
), |
| 209 |
|
| 210 |
// date_created. |
| 211 |
array( |
| 212 |
'name' => 'date_created', |
| 213 |
'type' => 'datetime', |
| 214 |
'default' => '0000-00-00 00:00:00', |
| 215 |
'created' => true, |
| 216 |
'date_query' => true, |
| 217 |
'sortable' => true, |
| 218 |
), |
| 219 |
|
| 220 |
// date_modified. |
| 221 |
array( |
| 222 |
'name' => 'date_modified', |
| 223 |
'type' => 'datetime', |
| 224 |
'default' => '0000-00-00 00:00:00', |
| 225 |
'modified' => true, |
| 226 |
'date_query' => true, |
| 227 |
'sortable' => true, |
| 228 |
), |
| 229 |
|
| 230 |
// uuid. |
| 231 |
array( |
| 232 |
'name' => 'uuid', |
| 233 |
'uuid' => true, |
| 234 |
), |
| 235 |
|
| 236 |
); |
| 237 |
} |
| 238 |
|