# makecommerce/3.0.12/includes/activator.php

MakeCommerce for WooCommerce, version 3.0.12. 81 lines.

- Page: https://pluginprobe.com/plugins/makecommerce/3.0.12/code/includes/activator.php
- Raw: https://pluginprobe.com/plugins/makecommerce/3.0.12/raw/includes/activator.php
- Modified: 2022-03-30T10:54:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/makecommerce/3.0.12/code/includes/activator.php#L10-L20`.

```php
<?php

namespace MakeCommerce;

/**
 * Fired during plugin activation.
 *
 * This class defines all code necessary to run during the plugin's activation.
 *
 * @since      3.0.0
 * @package    Makecommerce
 * @subpackage Makecommerce/includes
 * @author     Maksekeskus AS <support@maksekeskus.ee>
 */

 class Activator {

	/**
	 * Short Description. (use period)
	 *
	 * Long Description.
	 *
	 * @since    3.0.0
	 */
	public static function activate() {
		
		self::create_tables();
		
	}

	/**
	 * Creates db tables.
	 * 
	 * @since 3.0.12
	 */
	public static function create_tables() {
		global $wpdb;
		
		//Create table if it doesn't already exist
		$wpdb->query
		("
			CREATE TABLE IF NOT EXISTS 
				`" . $wpdb->prefix . MAKECOMMERCE_TABLENAME . "`
				(
					`id` mediumint(9) NOT NULL AUTO_INCREMENT, 
					`type` varchar(10) NOT NULL, 
					`country` char(2) NOT NULL, 
					`name` varchar(25) NOT NULL, 
					`url` varchar(250) NOT NULL, 
					`logo_url` varchar(250), 
					`channel` varchar(250),
					`display_name` varchar(250),
					`min_amount` mediumint(9), 
					`max_amount` mediumint(9), 
					PRIMARY KEY `id` (`id`)
				) 
			" . $wpdb->get_charset_collate() . ";
		");

		//Create sco table if it doesn't already exist
		$wpdb->query
		("
			CREATE TABLE IF NOT EXISTS
				`" .  $wpdb->prefix . MAKECOMMERCE_SCO_TABLENAME . "`
				(
					`id` int(11) unsigned not null auto_increment,
					`cart_id` varchar(64) not null default '',
					`order_id` int(10) unsigned not null,
					`created` int(10) unsigned not null,
					`modified` int(10) unsigned not null,
					`status` tinyint unsigned not null,
					`content` mediumtext,
					primary key id (`id`),
					key `cart_id` (`cart_id`)
				)
			" . $wpdb->get_charset_collate() . ";
		");
	}

}

```
