| 1 |
<?php |
| 2 |
|
| 3 |
namespace MakeCommerce; |
| 4 |
|
| 5 |
/** |
| 6 |
* Fired during plugin activation. |
| 7 |
* |
| 8 |
* This class defines all code necessary to run during the plugin's activation. |
| 9 |
* |
| 10 |
* @since 3.0.0 |
| 11 |
* @package Makecommerce |
| 12 |
* @subpackage Makecommerce/includes |
| 13 |
* @author Maksekeskus AS <support@maksekeskus.ee> |
| 14 |
*/ |
| 15 |
|
| 16 |
class Activator { |
| 17 |
|
| 18 |
/** |
| 19 |
* Short Description. (use period) |
| 20 |
* |
| 21 |
* Long Description. |
| 22 |
* |
| 23 |
* @since 3.0.0 |
| 24 |
*/ |
| 25 |
public static function activate() { |
| 26 |
|
| 27 |
global $wpdb; |
| 28 |
|
| 29 |
//Create table if it doesn't already exist |
| 30 |
$wpdb->query |
| 31 |
(" |
| 32 |
CREATE TABLE IF NOT EXISTS |
| 33 |
`" . $wpdb->prefix . MAKECOMMERCE_TABLENAME . "` |
| 34 |
( |
| 35 |
`id` mediumint(9) NOT NULL AUTO_INCREMENT, |
| 36 |
`type` varchar(10) NOT NULL, |
| 37 |
`country` char(2) NOT NULL, |
| 38 |
`name` varchar(25) NOT NULL, |
| 39 |
`url` varchar(250) NOT NULL, |
| 40 |
`logo_url` varchar(250), |
| 41 |
`min_amount` mediumint(9), |
| 42 |
`max_amount` mediumint(9), |
| 43 |
UNIQUE KEY `id` (`id`) |
| 44 |
) |
| 45 |
" . $wpdb->get_charset_collate() . "; |
| 46 |
"); |
| 47 |
|
| 48 |
//Create sco table if it doesn't already exist |
| 49 |
$wpdb->query |
| 50 |
(" |
| 51 |
CREATE TABLE IF NOT EXISTS |
| 52 |
`" . $wpdb->prefix . MAKECOMMERCE_SCO_TABLENAME . "` |
| 53 |
( |
| 54 |
`id` int(11) unsigned not null auto_increment, |
| 55 |
`cart_id` varchar(64) not null default '', |
| 56 |
`order_id` int(10) unsigned not null, |
| 57 |
`created` int(10) unsigned not null, |
| 58 |
`modified` int(10) unsigned not null, |
| 59 |
`status` tinyint unsigned not null, |
| 60 |
`content` mediumtext, |
| 61 |
unique key id (`id`), |
| 62 |
key `cart_id` (`cart_id`) |
| 63 |
) |
| 64 |
" . $wpdb->get_charset_collate() . "; |
| 65 |
"); |
| 66 |
} |
| 67 |
|
| 68 |
} |
| 69 |
|