| 1 |
<?php |
| 2 |
namespace StoreEngine\Database; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
class CreateOrderAddresses { |
| 9 |
|
| 10 |
public static function up( $prefix, $charset_collate ) { |
| 11 |
$table_name = $prefix . 'storeengine_order_addresses'; |
| 12 |
$sql = "CREATE TABLE IF NOT EXISTS {$table_name} ( |
| 13 |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 14 |
`order_id` bigint(20) unsigned NOT NULL, |
| 15 |
`address_type` varchar(20) DEFAULT NULL, |
| 16 |
`first_name` text, |
| 17 |
`last_name` text, |
| 18 |
`company` text, |
| 19 |
`address_1` text, |
| 20 |
`address_2` text, |
| 21 |
`city` text, |
| 22 |
`state` text, |
| 23 |
`postcode` text, |
| 24 |
`country` text, |
| 25 |
`email` varchar(320) DEFAULT NULL, |
| 26 |
`phone` varchar(100) DEFAULT NULL, |
| 27 |
PRIMARY KEY (`id`), |
| 28 |
UNIQUE KEY `address_type_order_id` (`address_type`,`order_id`), |
| 29 |
KEY `order_id` (`order_id`), |
| 30 |
KEY `email` (`email`(19)) |
| 31 |
) $charset_collate;"; |
| 32 |
|
| 33 |
dbDelta( $sql ); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
|