-- -------------------------------------------------------------
-- TablePlus 6.2.1(577)
--
-- https://tableplus.com/
--
-- Database: sg
-- Generation Time: 2025-01-22 13:09:50.2810
-- -------------------------------------------------------------


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


CREATE TABLE `2002snap` (
  `itemnumber` char(20) NOT NULL DEFAULT '',
  `localinv` int(11) DEFAULT NULL,
  `accessinv` int(11) DEFAULT NULL,
  `count` int(11) DEFAULT NULL,
  `osflag` char(1) DEFAULT NULL,
  `hideshow` char(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `_cc_auths` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ccp_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `ccp_ref` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ccp_result` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `ccp_auth` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ccp_avs` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ccp_message` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ccp_cvv2` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ccp_processor` enum('verisign','paradata','firstdata','firstdata_gge4','firstdata_gge4_indep') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'paradata',
  `ccp_transid` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ccp_tdate` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `card` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `card_md5` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `cardholder_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `is_approved` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_ref` (`ccp_ref`),
  KEY `idx_cid` (`ccp_cid`)
) ENGINE=InnoDB AUTO_INCREMENT=399578 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `_cc_payments` (
  `ccp_id` int(10) unsigned NOT NULL DEFAULT '0',
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `payment_id` int(10) unsigned NOT NULL DEFAULT '0',
  `ccp_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `ccp_type` char(1) NOT NULL DEFAULT '',
  `ccp_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `ccp_ref` varchar(40) NOT NULL DEFAULT '',
  `ccp_result` varchar(5) NOT NULL DEFAULT '0',
  `ccp_auth` varchar(10) NOT NULL DEFAULT '',
  `ccp_avs` varchar(20) NOT NULL DEFAULT '',
  `ccp_message` varchar(80) NOT NULL DEFAULT '',
  `ccp_cvv2` varchar(8) NOT NULL DEFAULT '',
  `ccp_origid` varchar(40) NOT NULL DEFAULT '',
  `ccp_processor` enum('verisign','paradata','firstdata','firstdata_gge4','firstdata_gge4_indep','payhub') NOT NULL DEFAULT 'paradata',
  `ccp_transid` varchar(45) NOT NULL DEFAULT '',
  `ccp_tdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `card` varchar(8) NOT NULL DEFAULT '',
  `card_md5` text NOT NULL,
  `cardholder_name` varchar(30) NOT NULL DEFAULT '',
  `is_saved_cc` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_approved` tinyint(3) unsigned DEFAULT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`order_id`,`payment_id`,`ccp_id`),
  KEY `idx_paymentid` (`payment_id`),
  KEY `idx_orderid` (`ccp_id`),
  KEY `idx_ref` (`ccp_ref`),
  KEY `idx_amt` (`ccp_amount`),
  KEY `idx_cid` (`ccp_cid`),
  KEY `_cc_payments_ccp_tdate_IDX` (`ccp_tdate`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `_notes` (
  `note_cid` int(11) NOT NULL DEFAULT '0',
  `note_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `note` mediumtext NOT NULL,
  `note_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `note_order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `note_added_by_cid` int(11) unsigned NOT NULL DEFAULT '0',
  `removed` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `removed_by_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `show_note_when_shipping` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`note_cid`,`note_id`),
  KEY `idx_order_id` (`note_order_id`),
  KEY `idx_orderid_cid` (`note_cid`,`note_order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `_order` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `other_id` varchar(45) NOT NULL DEFAULT '',
  `order_poid` varchar(100) NOT NULL DEFAULT '',
  `order_email` varchar(80) NOT NULL DEFAULT '',
  `order_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `order_uid` varchar(20) NOT NULL DEFAULT '0',
  `order_status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order_status_for_customer` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_flagged` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order_comment` text NOT NULL,
  `order_special` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order_sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_created_onlydate` date NOT NULL DEFAULT '0000-00-00',
  `date_placed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_placed_onlydate` date NOT NULL DEFAULT '0000-00-00',
  `date_paid` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_paid_onlydate` date NOT NULL DEFAULT '0000-00-00',
  `date_ready` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_ready_onlydate` date NOT NULL DEFAULT '0000-00-00',
  `date_picked` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_postage_printed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_estimated_shipped` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_estimated_arrival` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_shipped` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_shipped_onlydate` date NOT NULL DEFAULT '0000-00-00',
  `date_need_shipby` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_cancelled` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `bill_firstname` varchar(80) NOT NULL DEFAULT '',
  `bill_lastname` varchar(45) NOT NULL DEFAULT '',
  `bill_company` varchar(80) NOT NULL DEFAULT '',
  `bill_street1` varchar(80) NOT NULL DEFAULT '',
  `bill_street2` varchar(80) NOT NULL DEFAULT '',
  `bill_city` varchar(80) NOT NULL DEFAULT '',
  `bill_country` varchar(2) NOT NULL DEFAULT '',
  `bill_state` varchar(80) NOT NULL DEFAULT '',
  `bill_zip` varchar(80) NOT NULL DEFAULT '',
  `bill_id` int(10) unsigned NOT NULL DEFAULT '0',
  `bill_phone` varchar(80) NOT NULL DEFAULT '',
  `ship_firstname` varchar(80) NOT NULL DEFAULT '',
  `ship_lastname` varchar(45) NOT NULL DEFAULT '',
  `ship_company` varchar(80) NOT NULL DEFAULT '',
  `ship_street1` varchar(80) NOT NULL DEFAULT '',
  `ship_street2` varchar(80) NOT NULL DEFAULT '',
  `ship_city` varchar(80) NOT NULL DEFAULT '',
  `ship_country` varchar(80) NOT NULL DEFAULT '',
  `ship_state` varchar(80) NOT NULL DEFAULT '',
  `ship_zip` varchar(80) NOT NULL DEFAULT '',
  `ship_residential` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_domestic` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_international` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_taxid` varchar(50) NOT NULL DEFAULT '0',
  `ship_id` int(10) unsigned NOT NULL DEFAULT '0',
  `ship_address_checked_and_ready` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ship_gift` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_gift_message` varchar(255) NOT NULL DEFAULT '',
  `ship_gift_anonymous` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_tier` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ship_to_wishlist` int(10) unsigned NOT NULL DEFAULT '0',
  `ship_same` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_method_selected` varchar(45) NOT NULL DEFAULT '',
  `ship_method_type` varchar(45) NOT NULL DEFAULT '',
  `ship_method_lock` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ship_method_rate` decimal(6,2) NOT NULL DEFAULT '0.00',
  `ship_method_rate_original` decimal(6,2) NOT NULL DEFAULT '0.00',
  `ship_method_cost` decimal(6,2) NOT NULL DEFAULT '0.00',
  `ship_method_rush` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_method_rushtoday` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_method_weight_oz` decimal(6,2) NOT NULL DEFAULT '0.00',
  `ship_method_actual_lbs` int(10) unsigned NOT NULL DEFAULT '0',
  `ship_method_actual_oz` int(10) unsigned NOT NULL DEFAULT '0',
  `ship_method_tracking` varchar(80) NOT NULL DEFAULT '',
  `ship_method_insurance` decimal(6,2) NOT NULL DEFAULT '0.00',
  `ship_method_signature` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_method_adultsignature` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ship_digital_agreement` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `summary_subtotal_retail` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_subtotal_savings` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_subtotal` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_clearance` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_subtotal_taxable` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_small_order_fee` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_shipping` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_discount` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_discount_subtotal` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_discount_shipping` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_discount_rush` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_discount_points` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_fee` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_tax` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_customercredit` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_total` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_paid` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_owes` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_est_cogs` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_cogs` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_cost` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_profit` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_points` int(10) NOT NULL DEFAULT '0',
  `stats_prod_pieces` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_prod_count` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_prod_downloadable` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_order_downloadable` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stats_has_preorder` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stats_order_bid` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_order_gc` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stats_cid_created` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_cid_picked` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_cid_shipped` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_cid_cancelled` int(10) unsigned NOT NULL DEFAULT '0',
  `summary_shipping_rush` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_subtotal_sold` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_subtotal_returned` decimal(8,2) NOT NULL DEFAULT '0.00',
  `summary_subtotal_digital` decimal(8,2) NOT NULL DEFAULT '0.00',
  `stats_order_pending` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stats_order_inventory` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_orig_id` varchar(150) NOT NULL DEFAULT '0',
  `copy_order_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ship_method_order_oz` decimal(6,2) NOT NULL DEFAULT '0.00',
  `stats_ip_created` varchar(16) NOT NULL DEFAULT '',
  `stats_browser_type` varchar(80) NOT NULL DEFAULT '',
  `stats_save_bill_address` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `stats_save_ship_address` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `stats_newsletter_add` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stats_sms_newsletter_add` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stats_special_items` int(10) unsigned NOT NULL DEFAULT '0',
  `conversion_tracking` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `cancel_reason` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `canceled_order_total` decimal(8,2) NOT NULL DEFAULT '0.00',
  `not_taxable` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `no_points` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_first_time` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ready_calc_taxes` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `referral_code` varchar(80) NOT NULL DEFAULT '',
  `warehouse_list` varchar(10) NOT NULL DEFAULT '',
  `customer_ref_number` varchar(30) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `stats_waiting_products` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_waiting_preorder` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_waiting_backorder` int(10) unsigned NOT NULL DEFAULT '0',
  `stats_waiting_comingsoon` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`),
  KEY `idx_cid` (`order_cid`),
  KEY `idx_date_created` (`date_created`),
  KEY `idx_date_placed` (`date_placed`),
  KEY `idx_date_paid` (`date_paid`),
  KEY `idx_date_shipped` (`date_shipped`),
  KEY `email` (`order_email`),
  KEY `idx_date_picked` (`date_picked`),
  KEY `order_special` (`order_special`),
  KEY `date_created_onlydate` (`date_created_onlydate`),
  KEY `date_placed_onlydate` (`date_placed_onlydate`),
  KEY `date_paid_onlydate` (`date_paid_onlydate`),
  KEY `date_shipped_onlydate` (`date_shipped_onlydate`),
  KEY `warehouse_list` (`warehouse_list`),
  KEY `date_ready` (`date_ready`),
  KEY `date_ready_onlydate` (`date_ready_onlydate`),
  KEY `order_type` (`order_type`),
  KEY `idx_status` (`order_status`,`is_flagged`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `_order_search_by` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `bill_firstname` varchar(80) NOT NULL DEFAULT '',
  `bill_lastname` varchar(45) NOT NULL DEFAULT '',
  `bill_company` varchar(80) NOT NULL DEFAULT '',
  `bill_street1` varchar(80) NOT NULL DEFAULT '',
  `bill_street2` varchar(80) NOT NULL DEFAULT '',
  `bill_phone` varchar(80) NOT NULL DEFAULT '',
  `ship_firstname` varchar(80) NOT NULL DEFAULT '',
  `ship_lastname` varchar(45) NOT NULL DEFAULT '',
  `ship_company` varchar(80) NOT NULL DEFAULT '',
  `ship_street1` varchar(80) NOT NULL DEFAULT '',
  `ship_street2` varchar(80) NOT NULL DEFAULT '',
  PRIMARY KEY (`order_id`),
  FULLTEXT KEY `idx` (`bill_firstname`,`bill_lastname`,`bill_company`,`bill_street1`,`bill_street2`,`bill_phone`,`ship_firstname`,`ship_lastname`,`ship_company`,`ship_street1`,`ship_street2`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `_permissions` (
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(80) NOT NULL DEFAULT '',
  `description` varchar(100) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `_tracking_likes` (
  `url` varchar(255) NOT NULL DEFAULT '',
  `count` int(10) unsigned NOT NULL DEFAULT '0',
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(4) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`url`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `_tracking_product_cat_view` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `cat` int(11) NOT NULL DEFAULT '0',
  `date` date NOT NULL DEFAULT '0000-00-00',
  `count` smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`cat`,`date`),
  KEY `idx_cat_date` (`cat`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `_users` (
  `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uid` varchar(23) NOT NULL DEFAULT '',
  `screenname` varchar(40) NOT NULL DEFAULT '',
  `password` varchar(40) NOT NULL DEFAULT '',
  `email` varchar(80) NOT NULL DEFAULT '',
  `firstname` varchar(80) NOT NULL DEFAULT '',
  `lastname` varchar(80) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`cid`),
  KEY `idx_screenname` (`screenname`,`cid`,`uid`),
  KEY `idx_email` (`email`,`cid`,`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=37471546 DEFAULT CHARSET=latin1;

CREATE TABLE `_users_permissions` (
  `uid` varchar(24) NOT NULL DEFAULT '0',
  `permission_id` int(10) unsigned NOT NULL DEFAULT '0',
  `enabled` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `expires` datetime DEFAULT NULL,
  `date_start` datetime DEFAULT NULL,
  PRIMARY KEY (`uid`,`permission_id`),
  KEY `idx_std` (`uid`,`permission_id`,`enabled`,`expires`,`date_start`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `_users_settings` (
  `uid` varchar(24) NOT NULL DEFAULT '',
  `name` varchar(45) NOT NULL DEFAULT '',
  `value` varchar(45) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uid`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `addresses` (
  `cid` double unsigned NOT NULL DEFAULT '0',
  `id` double unsigned NOT NULL DEFAULT '0',
  `uid` varchar(20) NOT NULL DEFAULT '',
  `fullname` varchar(80) NOT NULL DEFAULT '',
  `firstname` varchar(80) NOT NULL DEFAULT '',
  `lastname` varchar(80) NOT NULL DEFAULT '',
  `line1` varchar(80) NOT NULL DEFAULT '',
  `line2` varchar(80) NOT NULL DEFAULT '',
  `company` varchar(80) NOT NULL DEFAULT '',
  `city` varchar(80) NOT NULL DEFAULT '',
  `state` varchar(80) NOT NULL DEFAULT '',
  `zipcode` varchar(80) NOT NULL DEFAULT '',
  `country` varchar(80) NOT NULL DEFAULT '',
  `phone` varchar(80) NOT NULL DEFAULT '',
  `commercial` tinyint(3) unsigned DEFAULT '0',
  `otherstate` varchar(80) NOT NULL DEFAULT '',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `last_verified` date NOT NULL DEFAULT '0000-00-00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `crc` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`cid`),
  KEY `crc` (`crc`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `article_author` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `date_created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `bio` text NOT NULL,
  `flag_active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_publish` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `articles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(80) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `subtitle` varchar(180) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `text` mediumtext CHARACTER SET utf8 NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `date_added` date NOT NULL DEFAULT '0000-00-00',
  `link` varchar(150) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `image_url` varchar(150) NOT NULL DEFAULT '',
  `flag_anchor` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_showall` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_nolink` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_notitle` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_category_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `date_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_end` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `flag_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type` int(10) unsigned NOT NULL DEFAULT '0',
  `flag_bio` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_ct` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `flag_comment` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `views` int(10) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `idx_lookup` (`date_start`,`date_end`,`flag_active`,`store`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=108579945 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 33792 kB; InnoDB free: 20480 kB';

CREATE TABLE `asset_categories` (
  `category_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `assets` (
  `asset_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `name` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `description` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `size` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  `category_id` int(10) unsigned NOT NULL,
  `purchase_date` date NOT NULL,
  `purchase_value` decimal(10,2) NOT NULL,
  `purchase_order_number` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `assigned_to` int(10) unsigned NOT NULL,
  `manufacturer` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `warranty_expires` date DEFAULT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`asset_id`)
) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `attempts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `attempt_date` datetime NOT NULL,
  `attempt_type` tinyint(3) unsigned NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `ip` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `is_ignored` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21203 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `awards` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `amount_gc` decimal(6,2) NOT NULL DEFAULT '0.00',
  `amount_points` int(10) NOT NULL DEFAULT '0',
  `total_gc` decimal(6,2) NOT NULL DEFAULT '0.00',
  `total_points` int(10) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `count_gc` int(10) unsigned NOT NULL DEFAULT '0',
  `count_points` int(10) unsigned NOT NULL DEFAULT '0',
  `total_digi` decimal(6,2) unsigned NOT NULL DEFAULT '0.00',
  `count_digi` int(10) unsigned NOT NULL DEFAULT '0',
  `amount_digi` decimal(6,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `awards_digi` (
  `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `qty_free` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_pay` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_awarded` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=9000868 DEFAULT CHARSET=latin1;

CREATE TABLE `awards_digi_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `amount` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `oid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `issued_by_cid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=138458 DEFAULT CHARSET=latin1;

CREATE TABLE `awards_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `description` varchar(80) NOT NULL DEFAULT '',
  `sendto_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `sendto_email` varchar(80) NOT NULL DEFAULT '',
  `amount` decimal(6,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `sendto_screenname` varchar(30) NOT NULL DEFAULT '',
  `gc_code` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=75364 DEFAULT CHARSET=latin1;

CREATE TABLE `backend_bookmarks` (
  `cid` int(10) unsigned NOT NULL,
  `id` smallint(5) unsigned NOT NULL,
  `order` smallint(5) unsigned NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `category` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`cid`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `backend_menu` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `order` smallint(5) unsigned NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `category` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `pda_only` tinyint(3) unsigned NOT NULL,
  `desktop_only` tinyint(3) unsigned NOT NULL,
  `permission` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `short_cut` char(1) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=144 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cc_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `orderid` double NOT NULL DEFAULT '0',
  `type` char(1) NOT NULL DEFAULT '',
  `amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `ref` varchar(40) NOT NULL DEFAULT '',
  `result` tinyint(4) NOT NULL DEFAULT '0',
  `auth` varchar(10) NOT NULL DEFAULT '',
  `avs` varchar(20) NOT NULL DEFAULT '',
  `message` varchar(80) NOT NULL DEFAULT '',
  `cvv2` varchar(8) NOT NULL DEFAULT '',
  `origid` varchar(40) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `processor` enum('verisign','paradata') NOT NULL DEFAULT 'verisign',
  `transid` varchar(45) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `idx_orderid` (`orderid`),
  KEY `idx_ref` (`ref`),
  KEY `idx_amt` (`amount`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=101833 DEFAULT CHARSET=latin1;

CREATE TABLE `cha_previews` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `company` varchar(45) NOT NULL DEFAULT '',
  `ct` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `image` varchar(45) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `season` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`season`),
  UNIQUE KEY `Index_2` (`company`,`season`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=138 DEFAULT CHARSET=latin1;

CREATE TABLE `cha_previews_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `company_id` int(10) unsigned NOT NULL DEFAULT '0',
  `filename` varchar(45) NOT NULL DEFAULT '',
  `filesize` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `season` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`season`)
) ENGINE=InnoDB AUTO_INCREMENT=799 DEFAULT CHARSET=latin1;

CREATE TABLE `chat` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `text` varchar(255) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `room` int(10) unsigned NOT NULL DEFAULT '0',
  `to_cid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `Index_2` (`stamp`)
) ENGINE=InnoDB AUTO_INCREMENT=40542 DEFAULT CHARSET=latin1;

CREATE TABLE `cherry_hunt` (
  `cid` int(10) unsigned NOT NULL,
  `place_type` tinyint(3) unsigned NOT NULL,
  `place_id` int(10) unsigned NOT NULL,
  `thing_id` smallint(5) unsigned NOT NULL,
  `clicked` tinyint(3) unsigned NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`place_type`,`place_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherry_hunt_groups` (
  `group_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `date_start` date NOT NULL,
  `date_end` date NOT NULL,
  `daily_limit` smallint(5) unsigned NOT NULL DEFAULT '100',
  `active` tinyint(4) unsigned NOT NULL,
  PRIMARY KEY (`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherry_hunt_places` (
  `id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
  `place_type` tinyint(3) unsigned NOT NULL,
  `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `place_chance` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherry_hunt_summary` (
  `cid` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `points` smallint(5) unsigned NOT NULL,
  PRIMARY KEY (`cid`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherry_hunt_things` (
  `group_id` int(10) unsigned NOT NULL,
  `thing_id` int(10) unsigned NOT NULL,
  `action` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'found',
  `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `tooltip` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `value` tinyint(3) unsigned NOT NULL,
  `image` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `thing_chance` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`group_id`,`thing_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherrybox_months` (
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `send_date` date NOT NULL,
  `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `theme` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  `cherrybox_item_pid` int(10) unsigned NOT NULL DEFAULT '0',
  `cherrybox_receiving_id` int(10) unsigned NOT NULL DEFAULT '0',
  `limit` smallint(5) unsigned DEFAULT '0',
  `cutoff_day` tinyint(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`cherrybox_type_id`,`send_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherrybox_prices` (
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `cherrybox_price_id` int(10) unsigned NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `monthly_price` decimal(10,2) NOT NULL,
  `months` tinyint(3) unsigned NOT NULL,
  `bonus_points` smallint(5) unsigned NOT NULL,
  `is_active` tinyint(4) NOT NULL,
  PRIMARY KEY (`cherrybox_type_id`,`cherrybox_price_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherrybox_products` (
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `send_date` date NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `qty_full` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`cherrybox_type_id`,`send_date`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherrybox_reviews` (
  `cid` int(10) unsigned NOT NULL,
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `send_date` date NOT NULL,
  `rating` tinyint(3) unsigned NOT NULL,
  `review_text` text COLLATE utf8_unicode_ci NOT NULL,
  `date_added` datetime NOT NULL,
  `is_hidden` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`cherrybox_type_id`,`send_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cherrybox_types` (
  `cherrybox_type_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `image_url` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `weight_in_lbs` tinyint(4) unsigned NOT NULL,
  `cutoff_day` tinyint(4) NOT NULL,
  `months_send` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'empty for all or comma separated month numbers and end with comma',
  `is_active` tinyint(4) NOT NULL,
  PRIMARY KEY (`cherrybox_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `class_signup` (
  `class_id` int(10) unsigned NOT NULL,
  `spot_id` tinyint(3) unsigned NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `from_order_id` int(10) unsigned NOT NULL,
  `checked_in` tinyint(4) NOT NULL,
  PRIMARY KEY (`class_id`,`spot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `classes` (
  `class_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `class_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `signup_start` datetime NOT NULL,
  `signup_end` datetime NOT NULL,
  `class_type` tinyint(4) NOT NULL DEFAULT '0',
  `max_persons` tinyint(3) unsigned NOT NULL,
  `class_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `img_url` text COLLATE utf8_unicode_ci NOT NULL,
  `price` decimal(10,2) NOT NULL,
  PRIMARY KEY (`class_id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `conversion_tracker` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `ip` varchar(16) NOT NULL DEFAULT '',
  `safe` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `converted` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `converted_value` decimal(6,2) NOT NULL DEFAULT '0.00',
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11962260 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 1238016 kB';

CREATE TABLE `country_codes` (
  `name` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
  `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `ship_code` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `noship` tinyint(3) unsigned NOT NULL,
  `alternate_names` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `relevancy_booster` float(2,1) NOT NULL,
  `city_name` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'City',
  `zip_name` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Postal Code',
  `zip_required` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `state_name` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Province',
  `state_required` tinyint(3) unsigned NOT NULL COMMENT '0=no, 1=yes, 2=list',
  `tax_id_required_msg` text COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`name`),
  KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cron` (
  `name` varchar(50) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `location` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `description` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `last_error` varchar(255) NOT NULL DEFAULT '',
  `run_every` varchar(15) NOT NULL DEFAULT '0' COMMENT 'In minutes',
  `time_out` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT 'In minutes',
  `last_run` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `running` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `data_for_child` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `special` smallint(5) unsigned NOT NULL DEFAULT '0',
  `script_filename` varchar(50) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `script_started` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `disabled` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`name`,`location`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `cron_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '',
  `location` varchar(30) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `result` varchar(255) NOT NULL DEFAULT '',
  `time` smallint(5) unsigned NOT NULL DEFAULT '0',
  `extra_info` varchar(30) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_name` (`name`,`location`)
) ENGINE=InnoDB AUTO_INCREMENT=17933926 DEFAULT CHARSET=latin1;

CREATE TABLE `cron_log_bigdata` (
  `log_id` int(10) NOT NULL,
  `data` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  KEY `log_id` (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cron_temp_data` (
  `name` varchar(50) NOT NULL DEFAULT '',
  `data` mediumtext NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `cron_todo` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `for_action` varchar(80) NOT NULL DEFAULT '',
  `data` varchar(80) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_for_action` (`for_action`)
) ENGINE=InnoDB AUTO_INCREMENT=2584458 DEFAULT CHARSET=utf8;

CREATE TABLE `currency_exchange_rates` (
  `currency` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `rate` decimal(15,5) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`currency`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `current_inventory` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `itemnumber` varchar(20) NOT NULL DEFAULT '',
  `count` double(10,1) NOT NULL DEFAULT '0.0',
  `pending` int(11) NOT NULL DEFAULT '0',
  `onorder` int(11) NOT NULL DEFAULT '0',
  `onpreorder` int(11) NOT NULL DEFAULT '0',
  `available` int(11) NOT NULL DEFAULT '0',
  `infinite` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `lastsolddate` date NOT NULL DEFAULT '0000-00-00',
  `last_received_date` date NOT NULL DEFAULT '0000-00-00',
  `totalsold` int(10) unsigned NOT NULL DEFAULT '0',
  `count_shelf` int(10) NOT NULL DEFAULT '0',
  `count_preordered` int(10) unsigned NOT NULL DEFAULT '0',
  `count_other` int(10) unsigned NOT NULL DEFAULT '0',
  `count_hold` int(10) unsigned NOT NULL DEFAULT '0',
  `count_in_all_open_orders` int(10) unsigned NOT NULL DEFAULT '0',
  `avg_cost` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `baskets` int(10) unsigned NOT NULL DEFAULT '0',
  `show` tinyint(1) NOT NULL DEFAULT '0',
  `shelf_avail` int(11) NOT NULL DEFAULT '0',
  `hold_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `clear_preorder_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`),
  KEY `idx_stamp` (`stamp`),
  KEY `idx_summary` (`pid`,`available`),
  KEY `idx_available` (`available`,`pid`),
  KEY `idx_show` (`show`,`pid`),
  KEY `lastsolddate` (`lastsolddate`),
  KEY `lastsoldago` (`last_received_date`),
  KEY `count_shelf` (`count_shelf`),
  KEY `shelf_avail` (`shelf_avail`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 1063936 kB; InnoDB free: 950272 kB';

CREATE TABLE `current_inventory_trans` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `itemnumber` varchar(20) NOT NULL DEFAULT '',
  `countchange` smallint(6) NOT NULL DEFAULT '0',
  `oid` bigint(20) unsigned NOT NULL DEFAULT '0',
  `poid` double NOT NULL DEFAULT '0',
  `rid` double NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `description` varchar(50) NOT NULL DEFAULT '',
  `price` decimal(7,2) NOT NULL DEFAULT '0.00',
  `costeach` decimal(7,2) NOT NULL DEFAULT '0.00',
  `totalcost` decimal(7,2) NOT NULL DEFAULT '0.00',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_pid` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=263882 DEFAULT CHARSET=latin1;

CREATE TABLE `customer_credit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `customerid` varchar(80) NOT NULL DEFAULT '',
  `from_orderid` double(15,0) unsigned NOT NULL DEFAULT '0',
  `to_orderid` double(15,0) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `createdby` smallint(6) NOT NULL DEFAULT '0',
  `computername` varchar(50) NOT NULL DEFAULT '',
  `used` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `rsrc` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`rsrc`),
  KEY `idx_customerid` (`customerid`),
  KEY `idx_from_orderid` (`from_orderid`),
  KEY `idx_to_orderid` (`to_orderid`)
) ENGINE=InnoDB AUTO_INCREMENT=49914 DEFAULT CHARSET=latin1;

CREATE TABLE `daily_inventory` (
  `date` date NOT NULL DEFAULT '0000-00-00',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `amountsold` smallint(6) NOT NULL DEFAULT '0',
  `times_sold` smallint(6) NOT NULL DEFAULT '0',
  `qtyreceived` smallint(6) NOT NULL DEFAULT '0',
  `price` decimal(7,2) NOT NULL DEFAULT '0.00',
  `costeach` decimal(7,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`date`,`pid`),
  KEY `idx_pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `days` (
  `day` date NOT NULL DEFAULT '0000-00-00',
  `next` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`day`),
  KEY `idx_next` (`next`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `dblist_config` (
  `type` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `location_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `hash` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`type`,`location_name`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `designer_ct` (
  `investor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`investor_id`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `digital_sales_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `oid` double unsigned NOT NULL DEFAULT '0',
  `investor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `date_sold` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `amount` decimal(6,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `source` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`source`),
  KEY `Index_2` (`investor_id`),
  KEY `Index_3` (`date_sold`),
  KEY `Index_4` (`oid`),
  KEY `Index_5` (`pid`),
  KEY `Index_6` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=176669 DEFAULT CHARSET=latin1;

CREATE TABLE `dns_cache` (
  `key` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `value` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `drop_shippers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL DEFAULT '',
  `zipcode` varchar(15) NOT NULL DEFAULT '',
  `fee` decimal(6,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

CREATE TABLE `email` (
  `email_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `subject` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `html` text COLLATE utf8_unicode_ci NOT NULL,
  `text` text COLLATE utf8_unicode_ci NOT NULL,
  `for_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `campaign_type` smallint(5) unsigned NOT NULL DEFAULT '0',
  `campaign_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`email_id`),
  KEY `for_cid` (`for_cid`)
) ENGINE=InnoDB AUTO_INCREMENT=1372336 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_interests` (
  `email_id` int(10) unsigned NOT NULL DEFAULT '0',
  `interest_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`email_id`,`interest_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `email_newsletter` (
  `email_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `campaigner_id` int(10) unsigned NOT NULL DEFAULT '0',
  `email_address` varchar(100) NOT NULL DEFAULT '',
  `first_name` varchar(50) NOT NULL DEFAULT '',
  `max_emails_per_month` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `send_limit` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `no_newsletters` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `no_followups` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `no_comebacks` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `do_update` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `do_new` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_limit1` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_digi` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_warehouse` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_daily_deal` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_ws` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_sg` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_sg_warehouse` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_pase` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_blackfriday_cybermonday` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_first_subscribed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_last_opened` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_last_clicked` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`email_id`),
  KEY `subscription_acot` (`subscription_acot`),
  KEY `subscription_acot_digi` (`subscription_acot_digi`),
  KEY `subscription_acot_warehouse` (`subscription_acot_warehouse`),
  KEY `subscription_sg` (`subscription_sg`),
  KEY `subscription_pase` (`subscription_pase`),
  KEY `subscription_acot_daily_deal` (`subscription_acot_daily_deal`),
  KEY `subscription_acot_ws` (`subscription_acot_ws`),
  KEY `cid` (`cid`),
  KEY `subscription_acot_limit1` (`subscription_acot_limit1`),
  KEY `subscription_blackfriday_cybermonday` (`subscription_acot_blackfriday_cybermonday`),
  KEY `email_newsletter_email_address_IDX` (`email_address`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=718607 DEFAULT CHARSET=latin1;

CREATE TABLE `email_newsletter_change_log` (
  `log_id` int(11) NOT NULL AUTO_INCREMENT,
  `email_id` int(11) NOT NULL,
  `date_changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  `reason` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`log_id`)
) ENGINE=InnoDB AUTO_INCREMENT=603740 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_come_back_sent` (
  `cid` int(10) unsigned NOT NULL,
  `products` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `newsletter_id` int(10) unsigned NOT NULL,
  `sending_id` int(10) unsigned NOT NULL,
  `is_second` tinyint(3) unsigned NOT NULL,
  `date_sent` date DEFAULT NULL,
  KEY `cid` (`cid`),
  KEY `newsletter_id` (`newsletter_id`,`sending_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_isp_sent_tracking` (
  `date` date NOT NULL,
  `isp` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `sent` int(11) NOT NULL,
  PRIMARY KEY (`date`,`isp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_log` (
  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `no_newsletters` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `no_followups` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `no_comebacks` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_limit1` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_digi` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_warehouse` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_daily_deal` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_ws` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_sg` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_sg_warehouse` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_pase` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_acot_blackfriday_cybermonday` mediumint(3) unsigned NOT NULL DEFAULT '0',
  `subscription_sms` mediumint(8) unsigned NOT NULL,
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;

CREATE TABLE `email_newsletter_mailing` (
  `newsletter_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mailing_list` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `textblock_id` int(10) NOT NULL,
  `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `preheader` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `notes` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `filter` text COLLATE utf8_unicode_ci NOT NULL,
  `link_to` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `promo_id` int(10) unsigned NOT NULL,
  `promo_days` tinyint(3) unsigned NOT NULL,
  `date_send` datetime NOT NULL,
  `date_created` datetime DEFAULT NULL,
  `office_hour_sent` tinyint(4) NOT NULL DEFAULT '-1',
  `activated` tinyint(4) NOT NULL,
  `ready_generate_tosend` tinyint(4) NOT NULL,
  `hidden` tinyint(4) NOT NULL,
  `stat_sent` mediumint(8) NOT NULL,
  `stat_open` mediumint(8) NOT NULL,
  `stat_click` mediumint(8) NOT NULL,
  `stat_unsubscribed` mediumint(8) NOT NULL,
  `stat_hard_bounce` mediumint(8) NOT NULL,
  `stat_soft_bounce` mediumint(8) NOT NULL,
  `stat_blocked` mediumint(8) NOT NULL,
  `stat_spam_report` mediumint(8) NOT NULL,
  `stat_filtered` mediumint(8) NOT NULL,
  `stat_error` mediumint(8) NOT NULL,
  `stat_online_views` mediumint(8) NOT NULL,
  PRIMARY KEY (`newsletter_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6915 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_mailing_clicks` (
  `newsletter_id` int(11) unsigned NOT NULL,
  `sending_id` int(11) unsigned NOT NULL,
  `link_id` smallint(5) unsigned NOT NULL,
  `email_id` int(11) unsigned NOT NULL,
  `count` mediumint(8) unsigned NOT NULL,
  PRIMARY KEY (`newsletter_id`,`sending_id`,`link_id`,`email_id`),
  KEY `email_newsletter_mailing_clicks_newsletter_id_IDX` (`newsletter_id`,`sending_id`,`email_id`) USING BTREE,
  KEY `email_newsletter_mailing_clicks_email_id_IDX` (`email_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_mailing_content` (
  `newsletter_id` int(10) unsigned NOT NULL,
  `sending_id` int(10) unsigned NOT NULL,
  `content` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`newsletter_id`,`sending_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_mailing_emails` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `newsletter_id` int(10) unsigned NOT NULL,
  `email_id` int(10) unsigned NOT NULL,
  `sending_id` int(10) unsigned NOT NULL,
  `date_send` datetime NOT NULL,
  `date_sent` datetime NOT NULL,
  `stat_open` tinyint(4) NOT NULL,
  `stat_click` tinyint(4) NOT NULL,
  `stat_unsubscribed` tinyint(4) NOT NULL,
  `stat_hard_bounce` tinyint(4) NOT NULL,
  `stat_soft_bounce` tinyint(4) NOT NULL,
  `stat_blocked` tinyint(4) NOT NULL,
  `stat_spam_report` tinyint(4) NOT NULL,
  `stat_filtered` tinyint(4) NOT NULL,
  `stat_error` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx` (`newsletter_id`,`email_id`,`sending_id`),
  KEY `date_send` (`date_send`),
  KEY `email_id` (`email_id`)
) ENGINE=InnoDB AUTO_INCREMENT=190485493 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_mailing_emails_data` (
  `newsletter_id` int(11) NOT NULL,
  `sending_id` int(11) NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`newsletter_id`,`sending_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_mailing_links` (
  `newsletter_id` int(10) unsigned NOT NULL,
  `sending_id` int(10) unsigned NOT NULL,
  `link_id` smallint(5) unsigned NOT NULL,
  `url` text COLLATE utf8_unicode_ci NOT NULL,
  `clicks` mediumint(8) unsigned NOT NULL,
  PRIMARY KEY (`newsletter_id`,`sending_id`,`link_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_mailing_sending_source` (
  `date` date NOT NULL,
  `critsend` int(10) unsigned NOT NULL,
  `sparkpost` int(10) unsigned NOT NULL,
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_newsletter_subscription_source_log` (
  `subscription_date` date NOT NULL,
  `subscription_source` tinyint(4) NOT NULL,
  `subscription_qty` smallint(5) unsigned NOT NULL,
  PRIMARY KEY (`subscription_date`,`subscription_source`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `email_send` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `email_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `email` varchar(200) NOT NULL DEFAULT '',
  `date_sent` datetime DEFAULT NULL,
  `from_store` tinyint(3) unsigned DEFAULT NULL,
  `for_order_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cid` (`cid`),
  KEY `date_sent` (`date_sent`),
  KEY `email` (`email`),
  KEY `email_id` (`email_id`),
  KEY `for_order_id` (`for_order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1371561 DEFAULT CHARSET=latin1;

CREATE TABLE `emails` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `address` varchar(150) NOT NULL DEFAULT '',
  `subject` varchar(100) NOT NULL DEFAULT '',
  `date_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `campaign_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `campaign_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_date_sent` (`date_sent`),
  KEY `idx_cid` (`cid`),
  KEY `idx_order_id` (`order_id`),
  KEY `idx_campaign` (`campaign_type`,`campaign_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=33547 DEFAULT CHARSET=latin1;

CREATE TABLE `employee_access` (
  `employeeid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `access_to` varchar(25) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`employeeid`,`access_to`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `employee_covid19_answers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `employee_id` int(10) unsigned NOT NULL,
  `answer_date` date NOT NULL,
  `answer_datetime` datetime NOT NULL,
  `question_symptoms` tinyint(3) unsigned NOT NULL,
  `question_close_contact` tinyint(3) unsigned NOT NULL,
  `question_traveled` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `employee_id` (`employee_id`),
  KEY `answer_date` (`answer_date`)
) ENGINE=InnoDB AUTO_INCREMENT=2236 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `employee_last_loc` (
  `employee_id` int(11) NOT NULL DEFAULT '0',
  `lid` int(11) NOT NULL DEFAULT '0',
  `aisle` varchar(10) NOT NULL DEFAULT '',
  `rack` varchar(10) NOT NULL DEFAULT '',
  `hook` varchar(10) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`employee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `employees` (
  `employeeid` int(11) NOT NULL AUTO_INCREMENT,
  `lastname` varchar(50) NOT NULL DEFAULT '',
  `firstname` varchar(50) NOT NULL DEFAULT '',
  `title` varchar(50) NOT NULL DEFAULT '',
  `titleofcourtesy` varchar(50) NOT NULL DEFAULT '',
  `birthdate` datetime DEFAULT NULL,
  `hiredate` datetime DEFAULT NULL,
  `address` varchar(80) NOT NULL DEFAULT '',
  `city` varchar(80) NOT NULL DEFAULT '',
  `region` varchar(20) NOT NULL DEFAULT '',
  `postalcode` varchar(20) NOT NULL DEFAULT '',
  `country` varchar(50) NOT NULL DEFAULT '',
  `homephone` varchar(20) NOT NULL DEFAULT '',
  `cellphone` varchar(20) NOT NULL DEFAULT '',
  `cellphone_provider` varchar(20) NOT NULL DEFAULT '',
  `extension` varchar(10) NOT NULL DEFAULT '',
  `photo` mediumblob,
  `notes` mediumtext,
  `reportsto` int(11) DEFAULT NULL,
  `accesscontrol` varchar(8) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `chkchangepassword` char(2) DEFAULT NULL,
  `chgdate` datetime DEFAULT NULL,
  `discount` double DEFAULT NULL,
  `login_tries` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `inactive` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `cid` double unsigned NOT NULL DEFAULT '0',
  `uid` varchar(20) NOT NULL DEFAULT '',
  `backend_password` varchar(255) NOT NULL DEFAULT '',
  `backend_password_changed_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `hidden` tinyint(4) NOT NULL DEFAULT '0',
  `disabled` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`employeeid`),
  KEY `uid` (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=117 DEFAULT CHARSET=latin1;

CREATE TABLE `errors` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `error_date` datetime NOT NULL,
  `error_source` text COLLATE utf8_unicode_ci NOT NULL,
  `error_msg` text COLLATE utf8_unicode_ci NOT NULL,
  `error_data` text COLLATE utf8_unicode_ci NOT NULL,
  `error_type_source` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `error_date` (`error_date`)
) ENGINE=InnoDB AUTO_INCREMENT=15460 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `event_bar_colors` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `bar_color` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `bar_text_color` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `bar_link_color` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `bar_link_color_active` tinytext COLLATE utf8_unicode_ci NOT NULL,
  KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `events` (
  `event_id` int(11) NOT NULL AUTO_INCREMENT,
  `type` tinyint(4) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `text` varchar(900) COLLATE utf8_unicode_ci NOT NULL,
  `link` varchar(900) COLLATE utf8_unicode_ci NOT NULL,
  `store` tinyint(3) unsigned NOT NULL,
  `date_start` datetime NOT NULL,
  `date_end` datetime NOT NULL,
  `display_location` tinyint(4) NOT NULL,
  `display_theme` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `display_date_start` datetime DEFAULT NULL,
  `display_date_end` datetime DEFAULT NULL,
  `display_background_color` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`event_id`)
) ENGINE=InnoDB AUTO_INCREMENT=356 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `events_website_changes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `date_start` datetime NOT NULL,
  `date_end` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `date_start` (`date_start`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `fedex_shipment_items` (
  `order_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `description` varchar(100) NOT NULL,
  `upc` varchar(13) NOT NULL,
  `qty` smallint(5) unsigned NOT NULL,
  `value` decimal(7,2) unsigned NOT NULL,
  `weight` decimal(7,2) unsigned NOT NULL,
  `country_of_origin` varchar(5) NOT NULL,
  `hts` varchar(10) NOT NULL,
  PRIMARY KEY (`order_id`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `fedex_shipments` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `recipient_company` varchar(35) NOT NULL DEFAULT '',
  `recipient_contact` varchar(35) NOT NULL DEFAULT '',
  `recipient_address1` varchar(35) NOT NULL DEFAULT '',
  `recipient_address2` varchar(35) NOT NULL DEFAULT '',
  `recipient_city` varchar(20) NOT NULL DEFAULT '',
  `recipient_postalcode` varchar(10) NOT NULL DEFAULT '',
  `recipient_state` varchar(45) NOT NULL DEFAULT '',
  `recipient_country` varchar(2) NOT NULL DEFAULT '',
  `recipient_phone` varchar(15) NOT NULL DEFAULT '',
  `recipient_email` varchar(120) NOT NULL DEFAULT '',
  `recipient_tax_id` varchar(20) NOT NULL DEFAULT '',
  `exp_recipient_address1` varchar(35) NOT NULL DEFAULT '',
  `exp_recipient_address2` varchar(35) NOT NULL DEFAULT '',
  `exp_recipient_city` varchar(20) NOT NULL DEFAULT '',
  `exp_recipient_postalcode` varchar(10) NOT NULL DEFAULT '',
  `exp_recipient_state` varchar(45) NOT NULL DEFAULT '',
  `exp_recipient_country` varchar(2) NOT NULL DEFAULT '',
  `package_type` varchar(45) NOT NULL DEFAULT '',
  `package_service` varchar(45) NOT NULL DEFAULT '0',
  `package_value` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `package_weight` int(10) unsigned NOT NULL DEFAULT '0',
  `package_saturday_delivery` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `inter_declared_value` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `inter_carriage_value` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `signature` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `tracking` varchar(45) NOT NULL DEFAULT '',
  `total_discount` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `net_charge` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `shipped` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `address_check` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 CHECKSUM=1;

CREATE TABLE `file_destinations` (
  `file_type` varchar(50) NOT NULL DEFAULT '',
  `server_name` varchar(50) NOT NULL DEFAULT '',
  `server_ip` varchar(20) NOT NULL DEFAULT '',
  `base_path` varchar(100) NOT NULL DEFAULT '',
  `username` varchar(20) NOT NULL DEFAULT '',
  `password` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`server_name`,`file_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `followup_emails` (
  `followup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `html_spot_id` int(11) NOT NULL DEFAULT '0',
  `text_spot_id` int(10) unsigned NOT NULL DEFAULT '0',
  `subject` varchar(80) NOT NULL DEFAULT '',
  `date_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `days_after` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`followup_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

CREATE TABLE `followup_emails_sent` (
  `followup_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(11) NOT NULL DEFAULT '0',
  `date_sent` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`followup_id`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 11264 kB';

CREATE TABLE `footer_lines` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `block_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `block_order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `text1` varchar(150) NOT NULL DEFAULT '',
  `text2` varchar(150) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `store` (`store`)
) ENGINE=InnoDB AUTO_INCREMENT=5845 DEFAULT CHARSET=latin1;

CREATE TABLE `freshdesk_customer_updates` (
  `cid` int(10) unsigned NOT NULL,
  `needs_update` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `gallery` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `size` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `private` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `title` varchar(80) NOT NULL DEFAULT '',
  `description` text NOT NULL,
  `images` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `project` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `points_given` tinyint(1) unsigned DEFAULT NULL,
  `keywords` varchar(100) NOT NULL DEFAULT '',
  `folder` int(10) unsigned NOT NULL DEFAULT '0',
  `comments` int(10) unsigned NOT NULL DEFAULT '0',
  `favorites` int(10) unsigned NOT NULL DEFAULT '0',
  `views` int(10) unsigned NOT NULL DEFAULT '0',
  `primary_image_id` int(10) unsigned NOT NULL DEFAULT '0',
  `primary_image_type` varchar(4) NOT NULL DEFAULT '',
  `search_keywords` text NOT NULL,
  `winner` int(10) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned DEFAULT NULL,
  `video_id` varchar(25) NOT NULL DEFAULT '0',
  `datecreated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `datereveal` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `datesort` datetime DEFAULT '0000-00-00 00:00:00',
  `featured` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `cid` (`cid`),
  KEY `folder` (`folder`),
  KEY `datecreated` (`datecreated`),
  KEY `featured` (`featured`),
  KEY `winner` (`winner`),
  KEY `cid_datecreated` (`cid`,`datecreated`),
  KEY `summary` (`active`,`private`,`datecreated`,`type`,`cid`) USING BTREE,
  KEY `idx_latest_proj` (`project`,`active`,`private`,`datecreated`,`cid`,`id`) USING BTREE,
  KEY `idx_latest` (`active`,`private`,`datecreated`,`type`,`id`) USING BTREE,
  KEY `idx_latest_ct` (`active`,`private`,`datecreated`,`cid`,`id`) USING BTREE,
  KEY `idx_type` (`active`,`type`),
  KEY `main` (`type`,`cid`,`active`,`datecreated`,`datereveal`,`private`) USING BTREE,
  KEY `Index 14` (`active`,`datecreated`,`datereveal`,`private`)
) ENGINE=InnoDB AUTO_INCREMENT=354506 DEFAULT CHARSET=latin1;

CREATE TABLE `gallery_comments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `gallery_id` int(10) unsigned NOT NULL DEFAULT '0',
  `reply_to_comment_id` int(10) unsigned NOT NULL DEFAULT '0',
  `text` text NOT NULL,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `gave_point` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`,`gallery_id`),
  KEY `gallery_id` (`gallery_id`),
  KEY `cid` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=1647572 DEFAULT CHARSET=latin1;

CREATE TABLE `gallery_folders` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `Index_2` (`cid`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=16356 DEFAULT CHARSET=latin1;

CREATE TABLE `gallery_index` (
  `index_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `gallery_id` int(10) unsigned NOT NULL DEFAULT '0',
  `category_id` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`index_type`,`gallery_id`,`category_id`),
  KEY `index_type` (`index_type`),
  KEY `gallery_id` (`gallery_id`),
  KEY `Index_2` (`gallery_id`,`category_id`,`index_type`) USING BTREE,
  KEY `prod_look` (`index_type`,`category_id`),
  KEY `category_id` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 1286144 kB';

CREATE TABLE `gallery_type` (
  `id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL DEFAULT '',
  `is_selectable` tinyint(3) unsigned NOT NULL,
  `same_as` tinyint(3) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `gallery_videos` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `gallery_id` int(45) NOT NULL DEFAULT '0',
  `cid` int(45) NOT NULL DEFAULT '0',
  `link` varchar(255) NOT NULL DEFAULT '',
  `caption` varchar(255) NOT NULL DEFAULT '',
  `flagged` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `gallery_id` (`gallery_id`)
) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=latin1;

CREATE TABLE `gcdata` (
  `value` decimal(10,2) DEFAULT NULL,
  `dateissued` date DEFAULT NULL,
  `id` varchar(12) NOT NULL DEFAULT '',
  `ordernumber` varchar(20) DEFAULT NULL,
  `sendto` varchar(80) DEFAULT NULL,
  `sendfrom` varchar(80) DEFAULT NULL,
  `expire` date DEFAULT NULL,
  `email` varchar(80) DEFAULT NULL,
  `sentiment` blob,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=1;

CREATE TABLE `giftcertificates` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `orderid` int(11) unsigned NOT NULL DEFAULT '0',
  `receiptid` int(11) unsigned NOT NULL DEFAULT '0',
  `importid` bigint(20) unsigned NOT NULL DEFAULT '0',
  `amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `email` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `email_screenname` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `message` text CHARACTER SET latin1 NOT NULL,
  `private_note` text COLLATE utf8_unicode_ci NOT NULL,
  `sendto` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `sendfrom` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `sentdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `redeemeddate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `printeddate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `expiredate` date NOT NULL DEFAULT '0000-00-00',
  `startdate` date NOT NULL DEFAULT '0000-00-00',
  `date_send` date DEFAULT NULL,
  `redeemed_oid` varchar(10) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `from_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `locked_to_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `theme_textblock_id` int(11) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`code`),
  KEY `idx_code` (`code`),
  KEY `idx_id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=261836 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `giftcertificates_used` (
  `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `order_id` int(10) unsigned NOT NULL,
  `amount` decimal(10,2) unsigned NOT NULL,
  PRIMARY KEY (`code`,`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `google_analytics` (
  `date` date NOT NULL,
  `store` tinyint(4) unsigned NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `type_id` int(10) unsigned NOT NULL,
  `visitors` mediumint(8) unsigned NOT NULL,
  `visits` mediumint(8) unsigned NOT NULL,
  `new_visits` mediumint(8) unsigned NOT NULL,
  `pageviews` mediumint(8) unsigned NOT NULL,
  `unique_pageviews` mediumint(8) unsigned NOT NULL,
  `bounces` mediumint(8) unsigned NOT NULL,
  `avg_time_on_site` mediumint(8) unsigned NOT NULL,
  `transactions` mediumint(8) unsigned NOT NULL,
  `transaction_revenue` float unsigned NOT NULL,
  `revenue_per_transaction` float unsigned NOT NULL,
  `transaction_revenue_per_visit` float unsigned NOT NULL,
  PRIMARY KEY (`date`,`store`,`type`,`type_id`),
  KEY `type` (`type`,`type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `google_analytics_by_source` (
  `date` date NOT NULL,
  `store` tinyint(4) unsigned NOT NULL,
  `source` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `visitors` mediumint(8) unsigned NOT NULL,
  `visits` mediumint(8) unsigned NOT NULL,
  `new_visits` mediumint(8) unsigned NOT NULL,
  `pageviews` mediumint(8) unsigned NOT NULL,
  `unique_pageviews` mediumint(8) unsigned NOT NULL,
  `bounces` mediumint(8) unsigned NOT NULL,
  `avg_time_on_site` mediumint(8) unsigned NOT NULL,
  `transactions` mediumint(8) unsigned NOT NULL,
  `transaction_revenue` float unsigned NOT NULL,
  `revenue_per_transaction` float unsigned NOT NULL,
  `transaction_revenue_per_visit` float unsigned NOT NULL,
  PRIMARY KEY (`date`,`store`,`source`,`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `hunt` (
  `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `points` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `views` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `place_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=37504378 DEFAULT CHARSET=latin1;

CREATE TABLE `hunt_summary` (
  `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `points` int(10) unsigned NOT NULL DEFAULT '0',
  `found` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `hunt_date` date NOT NULL DEFAULT '0000-00-00',
  `hunt_winner` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`hunt_date`)
) ENGINE=InnoDB AUTO_INCREMENT=37492439 DEFAULT CHARSET=latin1;

CREATE TABLE `hunt_what` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `place_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `enabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `find_img1` mediumtext CHARACTER SET utf8 NOT NULL,
  `find_img1_name` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `find_img1_names` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `find_img1_chance` int(10) unsigned NOT NULL DEFAULT '0',
  `find_img2` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `find_img2_name` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `find_img2_chance` int(10) unsigned NOT NULL DEFAULT '0',
  `find_img2_points` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `find_img3` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `find_img3_name` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `find_img3_chance` int(10) unsigned NOT NULL DEFAULT '0',
  `find_img3_points` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;

CREATE TABLE `image_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `size` int(10) unsigned NOT NULL DEFAULT '0',
  `type` varchar(5) NOT NULL DEFAULT '',
  `height` smallint(5) unsigned NOT NULL DEFAULT '0',
  `width` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;

CREATE TABLE `innodb_monitor` (
  `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `investors` (
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL DEFAULT '',
  `notes` varchar(100) NOT NULL DEFAULT '',
  `created` date NOT NULL DEFAULT '0000-00-00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `company_id` int(10) unsigned NOT NULL DEFAULT '0',
  `artist_id` int(10) unsigned NOT NULL DEFAULT '0',
  `locked` tinyint(1) NOT NULL DEFAULT '0',
  `payment_method` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `paypal_email` varchar(80) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `issue_tracker_priorities` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL DEFAULT '',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;

CREATE TABLE `issue_tracker_statuses` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(40) NOT NULL DEFAULT '',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

CREATE TABLE `issue_tracker_times` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL DEFAULT '',
  `minutes` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

CREATE TABLE `jobs` (
  `job_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `date_created` datetime NOT NULL,
  `date_started` datetime NOT NULL,
  `date_finished` datetime NOT NULL,
  `what` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `query_hash` text COLLATE utf8_unicode_ci NOT NULL,
  `action` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  `total_num` mediumint(8) unsigned NOT NULL,
  `done_num` mediumint(8) unsigned NOT NULL,
  `complete` tinyint(3) unsigned NOT NULL,
  `result` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`job_id`),
  KEY `complete` (`complete`),
  KEY `what` (`what`)
) ENGINE=InnoDB AUTO_INCREMENT=3289 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `link_tracking` (
  `link` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `url_from` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `date` date NOT NULL,
  `clicks` mediumint(9) NOT NULL,
  PRIMARY KEY (`link`,`url_from`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `location_employee_actions_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `employeeid` smallint(5) unsigned NOT NULL DEFAULT '0',
  `aisle` varchar(5) NOT NULL DEFAULT '',
  `rack` varchar(5) NOT NULL DEFAULT '',
  `hook` varchar(5) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_employeeid` (`employeeid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `location_list_types` (
  `id` tinyint(4) NOT NULL DEFAULT '0',
  `name` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `location_order` (
  `aisle` varchar(10) NOT NULL DEFAULT '',
  `aisle_rank` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`aisle`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='can be deleted after updates to pt system';

CREATE TABLE `location_product_past` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL,
  `new_location` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `past_location` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `changed_because_pid` int(11) NOT NULL DEFAULT '0',
  `date_changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `pid` (`pid`,`date_changed`),
  KEY `date_changed` (`date_changed`)
) ENGINE=InnoDB AUTO_INCREMENT=782025 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `location_rack_types` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL DEFAULT '',
  `holds` varchar(45) NOT NULL DEFAULT '',
  `hooks` int(10) unsigned NOT NULL DEFAULT '0',
  `hook_start` int(10) unsigned NOT NULL DEFAULT '1',
  `hooks_easy` varchar(255) NOT NULL DEFAULT '',
  `hooks_hard` varchar(255) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;

CREATE TABLE `location_type` (
  `aisle` varchar(5) NOT NULL DEFAULT '',
  `rack` varchar(5) NOT NULL DEFAULT '',
  `type` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`aisle`,`rack`),
  KEY `idx_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `locations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `aisle` varchar(5) NOT NULL DEFAULT '',
  `rack` varchar(5) NOT NULL DEFAULT '',
  `hook` varchar(5) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `Index_2` (`aisle`,`rack`,`hook`)
) ENGINE=InnoDB AUTO_INCREMENT=157044 DEFAULT CHARSET=latin1;

CREATE TABLE `locations_to_print` (
  `aisle` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `rack` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `hook` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `job` int(10) unsigned NOT NULL,
  `done` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`aisle`,`rack`,`hook`,`job`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `lockdown_ip` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `date_start` datetime NOT NULL,
  `date_end` datetime NOT NULL,
  `type` tinyint(4) NOT NULL,
  `reason` tinyint(4) NOT NULL,
  `deleted` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `ip_address` (`ip_address`,`date_start`,`date_end`)
) ENGINE=InnoDB AUTO_INCREMENT=22541 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `lockdown_user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL,
  `date_start` datetime NOT NULL,
  `date_end` datetime NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `reason` tinyint(3) unsigned NOT NULL,
  `deleted` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `cid` (`cid`,`date_start`,`date_end`)
) ENGINE=InnoDB AUTO_INCREMENT=1171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `locks` (
  `what` varchar(25) NOT NULL DEFAULT '',
  `extra_info` varchar(25) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`what`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `log` (
  `log_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `log_src` tinyint(2) unsigned NOT NULL DEFAULT '0',
  `log_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `log_type_id` int(10) unsigned NOT NULL DEFAULT '0',
  `log_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `log_uid` varchar(24) NOT NULL DEFAULT '',
  `log_ip` varchar(20) NOT NULL DEFAULT '',
  `action_type` int(10) unsigned NOT NULL DEFAULT '0',
  `action_description` varchar(160) NOT NULL DEFAULT '',
  `action_data` varchar(255) NOT NULL DEFAULT '',
  `action_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`log_id`,`log_src`),
  KEY `idx_id` (`log_type`,`log_type_id`),
  KEY `idx_log_cid` (`log_cid`)
) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=latin1;

CREATE TABLE `log_2008` (
  `log_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `log_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `log_type_id` int(10) unsigned NOT NULL DEFAULT '0',
  `log_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `log_uid` varchar(24) NOT NULL DEFAULT '',
  `log_ip` varchar(35) NOT NULL DEFAULT '',
  `action_type` int(10) unsigned NOT NULL DEFAULT '0',
  `action_description` varchar(160) NOT NULL DEFAULT '',
  `action_data` varchar(255) NOT NULL DEFAULT '',
  `action_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`log_id`),
  KEY `idx_id` (`log_type`,`log_type_id`),
  KEY `idx_log_cid` (`log_cid`)
) ENGINE=InnoDB AUTO_INCREMENT=222964950 DEFAULT CHARSET=utf8;

CREATE TABLE `log_active_users` (
  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `loggedin` smallint(5) unsigned NOT NULL DEFAULT '0',
  `others` smallint(5) unsigned NOT NULL DEFAULT '0',
  `bots` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `log_extra` (
  `log_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `data` text NOT NULL,
  PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `log_extra_2008` (
  `log_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `data` text NOT NULL,
  PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `log_newsletter_subscriptions` (
  `date` date NOT NULL DEFAULT '0000-00-00',
  `subscribe_acot` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_acot_limit1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot_limit1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_acot_digi` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot_digi` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_acot_warehouse` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot_warehouse` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_acot_daily_deal` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot_daily_deal` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_acot_ws` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot_ws` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_sg` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_sg` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_sg_warehouse` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_sg_warehouse` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_pase` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_pase` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subscribe_acot_blackfriday_cybermonday` smallint(5) unsigned NOT NULL DEFAULT '0',
  `unsubscribe_acot_blackfriday_cybermonday` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `login_fails` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uid` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `login_used` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `ip_address` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `domain` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `attempt_date` datetime NOT NULL,
  `ignored` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `attempt_date` (`attempt_date`),
  KEY `ip_address` (`ip_address`,`attempt_date`),
  KEY `uid` (`uid`,`attempt_date`)
) ENGINE=InnoDB AUTO_INCREMENT=1063239 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `long_data_cache` (
  `id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `members` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `start_date` date NOT NULL DEFAULT '0000-00-00',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `discount` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `length` int(10) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `start_orderid` double NOT NULL DEFAULT '0',
  `ezmlm` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`cid`,`start_orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `message` (
  `message_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `cid_from` int(10) unsigned NOT NULL DEFAULT '0',
  `cid_to` int(10) unsigned NOT NULL DEFAULT '0',
  `subject` varchar(50) NOT NULL DEFAULT '',
  `msg` text NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`message_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 261120 kB';

CREATE TABLE `my_download_files` (
  `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `download_count` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `download_max` tinyint(3) unsigned NOT NULL DEFAULT '3',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38000437 DEFAULT CHARSET=latin1;

CREATE TABLE `my_downloads` (
  `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `oid` int(10) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `date_sold` date NOT NULL DEFAULT '0000-00-00',
  `investor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `amount` decimal(6,2) NOT NULL DEFAULT '0.00',
  `date_added` date NOT NULL DEFAULT '0000-00-00',
  `reactivate` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `exclusive` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`pid`,`oid`),
  KEY `idx_pid` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=38000553 DEFAULT CHARSET=latin1;

CREATE TABLE `mybasket` (
  `uid` varchar(23) NOT NULL DEFAULT '',
  `cid` int(5) unsigned NOT NULL DEFAULT '0',
  `bid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `item` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'pid',
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `qty` smallint(5) unsigned NOT NULL DEFAULT '0',
  `link_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `from_promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  `price_id` int(10) unsigned NOT NULL,
  `price` decimal(10,2) unsigned NOT NULL,
  `price_type` tinyint(3) unsigned NOT NULL,
  `promo_price` decimal(10,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`cid`,`bid`,`item`,`sid`,`uid`),
  KEY `idx_bid` (`bid`),
  KEY `idx_item` (`item`),
  KEY `idx_cid_sid` (`cid`,`sid`),
  KEY `idx_uid_sid` (`uid`,`sid`),
  KEY `price_id` (`price_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `mybasket_gcdata` (
  `uid` varchar(24) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `bid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `description` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `to` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `from` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `message` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `sendto` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_send` date DEFAULT NULL,
  `theme_textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uid`,`pid`,`bid`,`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `mybasket_index` (
  `bid` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(60) NOT NULL DEFAULT '',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `sid` int(10) unsigned NOT NULL DEFAULT '0',
  `uid` varchar(23) NOT NULL DEFAULT '',
  PRIMARY KEY (`bid`,`cid`,`sid`,`uid`),
  UNIQUE KEY `name` (`name`,`uid`,`sid`,`cid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `mybasket_index_ids_list` (
  `id` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `mybasket_promos` (
  `uid` varchar(23) COLLATE utf8_unicode_ci NOT NULL,
  `bid` tinyint(4) NOT NULL,
  `sid` tinyint(4) NOT NULL,
  `promo_id` int(11) NOT NULL,
  `date_added` datetime DEFAULT NULL,
  PRIMARY KEY (`uid`,`bid`,`sid`,`promo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `mybasket_sorting` (
  `uid` varchar(23) COLLATE utf8_unicode_ci NOT NULL,
  `sid` tinyint(3) unsigned NOT NULL,
  `bid` tinyint(3) unsigned NOT NULL,
  `sort_field` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `sort_desc` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`uid`,`sid`,`bid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `mybasket_wish_removed` (
  `uid` varchar(23) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `by_order_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `qty` int(10) unsigned NOT NULL,
  PRIMARY KEY (`uid`,`by_order_id`,`pid`) USING BTREE,
  KEY `by_order_id` (`by_order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `new_suppliers` (
  `supplier_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `supplier_name` varchar(45) NOT NULL DEFAULT '',
  `supplier_contact` varchar(80) NOT NULL DEFAULT '',
  `supplier_street` varchar(80) NOT NULL DEFAULT '',
  `supplier_street2` varchar(80) NOT NULL DEFAULT '',
  `supplier_city` varchar(80) NOT NULL DEFAULT '',
  `supplier_state` varchar(80) NOT NULL DEFAULT '',
  `supplier_zipcode` varchar(15) NOT NULL DEFAULT '',
  `supplier_country` varchar(40) NOT NULL DEFAULT '',
  `supplier_phone` varchar(25) NOT NULL DEFAULT '',
  `supplier_phone2` varchar(25) NOT NULL DEFAULT '',
  `supplier_fax` varchar(25) NOT NULL DEFAULT '',
  `supplier_homepage` varchar(80) NOT NULL DEFAULT '',
  `supplier_email` varchar(80) NOT NULL DEFAULT '',
  `terms` varchar(20) NOT NULL DEFAULT '',
  `customer_number` varchar(45) NOT NULL DEFAULT '',
  `rep_name` varchar(80) NOT NULL DEFAULT '',
  `rep_email` varchar(80) NOT NULL DEFAULT '',
  `rep_phone` varchar(25) NOT NULL DEFAULT '',
  `rep_fax` varchar(25) NOT NULL DEFAULT '',
  `rep_sendto` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `company_id` int(10) unsigned NOT NULL DEFAULT '0',
  `investor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `hidden` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`supplier_id`)
) ENGINE=InnoDB AUTO_INCREMENT=463 DEFAULT CHARSET=latin1;

CREATE TABLE `newsletter_sms_init_subscription` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `by_cid` bigint(20) NOT NULL,
  `by_ip` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `source` tinyint(3) unsigned NOT NULL,
  `date_init` datetime NOT NULL,
  `date_expires` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `newsletter_sms_init_subscription_date_expires_IDX` (`date_expires`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7808 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `newsletter_sms_sent_index` (
  `sid` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `newsletter_id` bigint(20) unsigned NOT NULL,
  `sending_id` int(10) unsigned NOT NULL,
  `email_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `newsletter_sms_subscription_changes` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `date_changed` datetime NOT NULL,
  `new_status` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3695 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `newsletter_sms_subscription_status` (
  `phone_number` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `status` tinyint(3) unsigned NOT NULL,
  `date_subscribed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`phone_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `nextcid` (
  `id` tinyint(4) NOT NULL DEFAULT '0',
  `nextcid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `notify` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `uid` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `message` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `link` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `expires` datetime DEFAULT NULL,
  `notify_key` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `color_text` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ffffff',
  `color_background` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT '86afcc',
  `offer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `notify_key` (`uid`,`notify_key`),
  KEY `idx_check_offer` (`uid`,`offer_id`,`expires`),
  KEY `idx_lookup` (`uid`,`active`,`store`)
) ENGINE=InnoDB AUTO_INCREMENT=367122 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `notify_email_permissions` (
  `uid` varchar(20) NOT NULL DEFAULT '',
  `type` tinyint(20) NOT NULL DEFAULT '0',
  `allow` varchar(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `notions_categories` (
  `csc` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `cat_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`csc`),
  KEY `description` (`description`),
  KEY `cat_id` (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `notions_confirms_files` (
  `filename` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `content` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`filename`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `notions_import_seen` (
  `notions_itemnumber` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `date_first_seen` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `notions_item_files` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `date_received` date NOT NULL,
  `filename` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `item_count` int(10) unsigned NOT NULL,
  `todo` int(10) unsigned NOT NULL,
  `stats_added` int(10) unsigned NOT NULL,
  `stats_updated` int(10) unsigned NOT NULL,
  `stats_missing_info` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=471 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `notions_item_files_data` (
  `id` smallint(5) unsigned NOT NULL,
  `notions_itemnumber` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `line_content` text COLLATE utf8_unicode_ci NOT NULL,
  `todo` tinyint(3) unsigned NOT NULL,
  `error` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`,`notions_itemnumber`),
  KEY `notions_itemnumber` (`notions_itemnumber`),
  KEY `todo` (`todo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `notions_item_inventory_hourly_data` (
  `source` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'b2c',
  `stamp` datetime NOT NULL,
  `data` longtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`source`,`stamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_checkout_extra` (
  `order_id` int(10) unsigned NOT NULL,
  `method` tinyint(3) unsigned NOT NULL,
  `token` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `payerid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `payer_status` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `address_status` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_cherrybox_subscriptions` (
  `order_id` int(10) unsigned NOT NULL,
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `cherrybox_price_id` int(10) unsigned NOT NULL,
  `activated_subscription_id` int(10) unsigned NOT NULL DEFAULT '0',
  `for_subscription_id` int(10) unsigned NOT NULL,
  `refund_months` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `refund_shipping_each` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `send_date` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`order_id`,`cherrybox_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_class_signup` (
  `order_id` int(10) unsigned NOT NULL,
  `class_id` int(10) unsigned NOT NULL,
  `spots` tinyint(3) unsigned NOT NULL,
  `names_list` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_costs` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `orderid` bigint(20) unsigned DEFAULT NULL,
  `recieptid` int(11) DEFAULT NULL,
  `itemnumber` varchar(40) NOT NULL DEFAULT '',
  `costeach` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `count` smallint(6) NOT NULL DEFAULT '0',
  `qty_fraction` tinyint(4) NOT NULL DEFAULT '0',
  `daterec` date NOT NULL DEFAULT '0000-00-00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `pi_id` int(10) unsigned NOT NULL DEFAULT '0',
  `pending` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `orderid` (`orderid`),
  KEY `recieptid` (`recieptid`),
  KEY `itemnumber` (`itemnumber`),
  KEY `idx_pid` (`pid`),
  KEY `idx_id` (`pi_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14495527 DEFAULT CHARSET=latin1;

CREATE TABLE `order_dates` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `order_status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_created` date NOT NULL DEFAULT '0000-00-00',
  `date_placed` date NOT NULL DEFAULT '0000-00-00',
  `date_paid` date NOT NULL DEFAULT '0000-00-00',
  `date_picked` date NOT NULL DEFAULT '0000-00-00',
  `date_shipped` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`order_id`),
  KEY `idx_created` (`date_created`),
  KEY `idx_placed` (`date_placed`),
  KEY `idx_paid` (`date_paid`),
  KEY `idx_picked` (`date_picked`),
  KEY `idx_shipped` (`date_shipped`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `order_discount_items` (
  `order_id` int(10) unsigned NOT NULL,
  `discount_id` tinyint(3) unsigned NOT NULL,
  `which` tinyint(3) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `qty` smallint(5) unsigned NOT NULL,
  `amount` decimal(10,2) unsigned NOT NULL,
  PRIMARY KEY (`order_id`,`discount_id`,`which`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_discounts` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `discount_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `discount_code` varchar(20) NOT NULL DEFAULT '',
  `discount_type` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `discount_amount` decimal(8,2) NOT NULL DEFAULT '0.00',
  `discount_amount_subtotal` decimal(8,2) NOT NULL DEFAULT '0.00',
  `discount_amount_shipping` decimal(8,2) NOT NULL DEFAULT '0.00',
  `discount_amount_rush` decimal(8,2) NOT NULL DEFAULT '0.00',
  `discount_amount_points` mediumint(9) NOT NULL DEFAULT '0',
  `discount_data` tinyint(4) NOT NULL DEFAULT '0',
  `discount_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `discount_active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `discount_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `discount_is_advertising` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `discount_is_donation` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`order_id`,`discount_id`),
  KEY `idx_code` (`discount_code`,`discount_type`,`discount_active`),
  KEY `idx_type` (`discount_type`,`discount_code`,`discount_active`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 608256 kB';

CREATE TABLE `order_errors` (
  `order_id` int(10) unsigned NOT NULL,
  `error_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `date_added` datetime NOT NULL,
  PRIMARY KEY (`order_id`,`error_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_extra_data` (
  `order_id` int(10) unsigned NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `value` text COLLATE utf8_unicode_ci NOT NULL,
  UNIQUE KEY `order_extra_data_order_id_IDX` (`order_id`,`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_flagged_reasons` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` int(10) unsigned NOT NULL,
  `flag_type` tinyint(3) unsigned NOT NULL,
  `dismissed` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `order_id` (`order_id`,`dismissed`)
) ENGINE=InnoDB AUTO_INCREMENT=54701 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_giveouts` (
  `order_id` int(10) unsigned NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`order_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_items` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `order_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `prod_pid` int(10) unsigned NOT NULL DEFAULT '0',
  `prod_itemnumber` varchar(20) NOT NULL DEFAULT '',
  `prod_description` varchar(80) NOT NULL DEFAULT '',
  `prod_weight` decimal(6,2) unsigned NOT NULL DEFAULT '0.00',
  `prod_downloadable` tinyint(1) NOT NULL DEFAULT '0',
  `prod_ship_tier` int(11) NOT NULL DEFAULT '0',
  `prod_price` decimal(7,2) NOT NULL DEFAULT '0.00',
  `prod_price_sale` decimal(7,2) NOT NULL DEFAULT '0.00',
  `prod_price_reg` decimal(7,2) NOT NULL DEFAULT '0.00',
  `prod_price_id` int(10) unsigned NOT NULL DEFAULT '0',
  `prod_points_multiplier` decimal(6,3) unsigned NOT NULL DEFAULT '1.000',
  `prod_points_bonus` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `prod_note` varchar(20) NOT NULL DEFAULT '',
  `prod_wishlist` int(11) NOT NULL DEFAULT '0',
  `prod_not_taxable` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `prod_no_promo` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `prod_offer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `prod_preorder` tinyint(4) NOT NULL DEFAULT '0',
  `prod_from_promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_ordered` int(11) NOT NULL DEFAULT '0',
  `qty_picked` int(11) NOT NULL DEFAULT '0',
  `qty_sent` int(11) NOT NULL DEFAULT '0',
  `qty_billed` int(11) NOT NULL DEFAULT '0',
  `qty_back` int(11) NOT NULL DEFAULT '0',
  `qty_max` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_placed` int(10) NOT NULL DEFAULT '0',
  `qty_placed_2` int(10) NOT NULL DEFAULT '0',
  `pending_mode` tinyint(4) NOT NULL DEFAULT '0',
  `pick_finished` tinyint(1) NOT NULL DEFAULT '0',
  `pick_skip` tinyint(1) NOT NULL DEFAULT '0',
  `back_order_id` int(11) NOT NULL DEFAULT '0',
  `discounted` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `summary_cogs` decimal(10,2) NOT NULL DEFAULT '0.00',
  `summary_profit` decimal(11,5) NOT NULL DEFAULT '0.00000',
  `summary_orderdate` date NOT NULL DEFAULT '0000-00-00',
  `summary_paiddate` date NOT NULL DEFAULT '0000-00-00',
  `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`order_id`,`prod_pid`),
  KEY `idx_orderdate` (`summary_orderdate`,`prod_pid`),
  KEY `idx_paiddate` (`summary_paiddate`,`prod_pid`),
  KEY `cid` (`order_cid`),
  KEY `prod_pid` (`prod_pid`),
  KEY `back_order_id` (`back_order_id`),
  KEY `prod_price_id` (`prod_price_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `order_items_clearance` (
  `order_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `price` decimal(8,2) NOT NULL DEFAULT '0.00',
  `qty` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_added` datetime NOT NULL,
  PRIMARY KEY (`order_id`,`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1230242323 DEFAULT CHARSET=latin1;

CREATE TABLE `order_items_eta` (
  `order_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `date_eta` date NOT NULL,
  UNIQUE KEY `order_items_eta_order_id_IDX` (`order_id`,`pid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_items_gcdata` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `description` varchar(80) NOT NULL DEFAULT '',
  `amount` decimal(8,2) unsigned NOT NULL DEFAULT '0.00',
  `to` varchar(80) NOT NULL DEFAULT '',
  `from` varchar(80) NOT NULL DEFAULT '',
  `message` varchar(255) NOT NULL DEFAULT '',
  `sendto` varchar(80) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `gc_code` varchar(24) NOT NULL DEFAULT '',
  `date_send` date DEFAULT NULL,
  `theme_textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `gc_added_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`,`pid`),
  KEY `gc_code` (`gc_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `order_late_scores` (
  `date` date NOT NULL,
  `score` smallint(6) NOT NULL,
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_late_scores_details` (
  `order_id` int(10) unsigned NOT NULL,
  `score` smallint(6) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_michaels_items` (
  `order_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `order_item_id` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `qty` smallint(6) NOT NULL,
  UNIQUE KEY `order_michaels_items_order_id_IDX` (`order_id`,`pid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_other_ids` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `other_id` varchar(45) NOT NULL DEFAULT '',
  PRIMARY KEY (`order_id`,`store`),
  KEY `idx_lookup` (`other_id`,`store`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `order_package_details` (
  `order_id` int(10) unsigned NOT NULL,
  `package_id` tinyint(3) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `qty` smallint(5) unsigned NOT NULL,
  PRIMARY KEY (`order_id`,`package_id`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_packages` (
  `order_id` int(11) NOT NULL,
  `package_id` tinyint(3) unsigned NOT NULL,
  `warehouse` tinyint(3) unsigned NOT NULL,
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `force_allow` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `items_subtotal` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `items_discounts` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `items_cost` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT 'cogs if source is acot, otherwise it is the cost',
  `items_pieces` smallint(5) unsigned NOT NULL DEFAULT '0',
  `ship_method` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `tracking` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `est_ship_cost` decimal(6,2) NOT NULL DEFAULT '0.00',
  `ship_cost` decimal(6,2) NOT NULL DEFAULT '0.00',
  `true_cost` decimal(6,2) NOT NULL DEFAULT '0.00' COMMENT 'rate imported',
  `prod_weight_oz` decimal(6,2) NOT NULL DEFAULT '0.00',
  `est_weight_oz` decimal(6,2) NOT NULL DEFAULT '0.00',
  `real_weight_oz` decimal(6,2) NOT NULL DEFAULT '0.00',
  `reted_weight_oz` decimal(6,2) NOT NULL DEFAULT '0.00',
  `dim_height` smallint(5) unsigned NOT NULL DEFAULT '0',
  `dim_width` smallint(5) unsigned NOT NULL DEFAULT '0',
  `dim_length` smallint(5) unsigned NOT NULL DEFAULT '0',
  `est_packaging` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `est_ship_date` date NOT NULL DEFAULT '0000-00-00',
  `est_date_delivery` date NOT NULL DEFAULT '0000-00-00',
  `est_date_delivery2` date NOT NULL DEFAULT '0000-00-00',
  `date_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_shipped` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_delivered` date NOT NULL DEFAULT '0000-00-00',
  `send_email` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`,`package_id`),
  KEY `warehouse` (`warehouse`),
  KEY `send_email` (`send_email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_payment` (
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `payment_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `payment_cid` varchar(20) NOT NULL DEFAULT '',
  `payment_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `payment_subtype` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `payment_amount` decimal(8,2) NOT NULL DEFAULT '0.00',
  `payment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `payment_active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `payment_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `payment_code` varchar(40) NOT NULL DEFAULT '',
  `payment_code_other` varchar(40) NOT NULL DEFAULT '',
  `payment_precode` varchar(40) NOT NULL DEFAULT '',
  `payment_card_id` int(11) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`order_id`,`payment_id`),
  KEY `cid` (`payment_cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `order_pepperjam` (
  `order_id` int(10) unsigned NOT NULL,
  `update_order_info` tinyint(3) unsigned NOT NULL,
  `clickid` text COLLATE utf8_unicode_ci,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_relations` (
  `order_id_from` int(10) unsigned NOT NULL,
  `order_id_to` int(10) unsigned NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `done_by_cid` int(10) unsigned NOT NULL,
  PRIMARY KEY (`order_id_from`,`order_id_to`),
  KEY `order_id_to` (`order_id_to`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_sa` (
  `order_id` int(10) unsigned NOT NULL,
  `est_delivery_date` date NOT NULL,
  `is_delivered` tinyint(1) NOT NULL,
  `sa_told_followup_date` date NOT NULL,
  `sa_told_canceled` tinyint(1) NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_shareasale` (
  `order_id` int(10) unsigned NOT NULL,
  `update_order_info` tinyint(3) unsigned NOT NULL,
  `sscid` text COLLATE utf8_unicode_ci,
  `update_comment` tinyint(3) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_ship_rate_lock` (
  `order_id` int(10) unsigned NOT NULL,
  `method` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `products_weight` decimal(10,2) NOT NULL,
  `ship_zip` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_status_notify` (
  `order_id` int(10) unsigned NOT NULL,
  `status` tinyint(3) unsigned NOT NULL,
  `date_changed` datetime NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_tax_info` (
  `taxinfo_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` int(10) unsigned NOT NULL,
  `total_amount_without_tax` decimal(10,2) NOT NULL,
  `total_shipping` decimal(10,2) NOT NULL,
  `total_taxes_to_collect` decimal(10,2) NOT NULL,
  `to_address_json` text COLLATE utf8_unicode_ci NOT NULL,
  `info_hash` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `type` tinyint(4) NOT NULL,
  `status` tinyint(4) NOT NULL,
  `stamp` datetime NOT NULL,
  PRIMARY KEY (`taxinfo_id`),
  KEY `order_id` (`order_id`),
  KEY `info_hash` (`info_hash`),
  KEY `stamp` (`stamp`)
) ENGINE=InnoDB AUTO_INCREMENT=1192961 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_tax_info_products` (
  `taxinfo_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `qty` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `discount` decimal(10,2) NOT NULL,
  `item_taxes_to_collect` decimal(10,2) NOT NULL,
  PRIMARY KEY (`taxinfo_id`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_temp_data` (
  `order_id` int(10) NOT NULL,
  `name` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
  `value` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `stamp` datetime DEFAULT NULL,
  PRIMARY KEY (`order_id`,`name`),
  KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_temp_data_long` (
  `order_id` int(10) NOT NULL,
  `name` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
  `value` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`order_id`,`name`),
  KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `order_walmart_items` (
  `order_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `linenumber` smallint(5) unsigned NOT NULL,
  `qty` smallint(6) NOT NULL,
  PRIMARY KEY (`order_id`,`pid`,`linenumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `ordernumber` (
  `id` tinyint(4) NOT NULL DEFAULT '1',
  `number` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `orders` (
  `orderid` double(15,0) unsigned NOT NULL DEFAULT '0',
  `ordernumber` varchar(15) NOT NULL DEFAULT '',
  `customerid` varchar(80) NOT NULL DEFAULT '',
  `orderdate_old` varchar(25) NOT NULL DEFAULT '',
  `shippeddate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `freight` decimal(8,2) NOT NULL DEFAULT '0.00',
  `shipname` varchar(40) NOT NULL DEFAULT '',
  `shipaddress` varchar(60) NOT NULL DEFAULT '',
  `shipcity` varchar(30) NOT NULL DEFAULT '',
  `shipregion` varchar(30) NOT NULL DEFAULT '',
  `shippostalcode` varchar(10) NOT NULL DEFAULT '',
  `shipcountry` varchar(30) NOT NULL DEFAULT '',
  `paymentmethod` varchar(40) NOT NULL DEFAULT '',
  `orderstatus` int(11) DEFAULT NULL,
  `ccauthorization` varchar(10) NOT NULL DEFAULT '',
  `orderdiscount` decimal(8,2) NOT NULL DEFAULT '0.00',
  `notes` text NOT NULL,
  `ordermessage` text NOT NULL,
  `creditcard1` varchar(50) NOT NULL DEFAULT '',
  `creditcard1exp` varchar(10) NOT NULL DEFAULT '',
  `creditcard1type` varchar(20) NOT NULL DEFAULT '',
  `ordersubtotal` decimal(8,2) NOT NULL DEFAULT '0.00',
  `ordertax` decimal(8,2) NOT NULL DEFAULT '0.00',
  `handlingfee` decimal(8,2) NOT NULL DEFAULT '0.00',
  `postalinsurance` decimal(8,2) NOT NULL DEFAULT '0.00',
  `ordercostofgoods` decimal(8,2) NOT NULL DEFAULT '0.00',
  `ordergrandtotal` decimal(8,2) NOT NULL DEFAULT '0.00',
  `gctotal` decimal(8,2) NOT NULL DEFAULT '0.00',
  `gcnumber` text NOT NULL,
  `Giftorder` char(2) NOT NULL DEFAULT '',
  `shipaddress2` varchar(80) NOT NULL DEFAULT '',
  `ordertimedatestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ccdeclined` char(2) NOT NULL DEFAULT '',
  `email` varchar(80) NOT NULL DEFAULT '',
  `finalemail` char(1) NOT NULL DEFAULT '',
  `declinedemail` char(1) NOT NULL DEFAULT '',
  `cid` double unsigned NOT NULL DEFAULT '0',
  `ordercode` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `uid` varchar(20) NOT NULL DEFAULT '',
  `shiplastname` varchar(40) NOT NULL DEFAULT '',
  `billfirstname` varchar(40) NOT NULL DEFAULT '',
  `billlastname` varchar(40) NOT NULL DEFAULT '',
  `billline1` varchar(60) NOT NULL DEFAULT '',
  `billline2` varchar(60) NOT NULL DEFAULT '',
  `billcity` varchar(40) NOT NULL DEFAULT '',
  `billregion` varchar(40) NOT NULL DEFAULT '',
  `billpostalcode` varchar(30) NOT NULL DEFAULT '',
  `billcountry` varchar(40) NOT NULL DEFAULT '',
  `shipresidential` tinyint(1) NOT NULL DEFAULT '0',
  `billphone` varchar(15) NOT NULL DEFAULT '',
  `billshipsame` char(1) NOT NULL DEFAULT '',
  `shipotherstate` varchar(40) NOT NULL DEFAULT '',
  `billotherstate` varchar(40) NOT NULL DEFAULT '',
  `promocode` varchar(80) NOT NULL DEFAULT '',
  `sgpoints` char(1) NOT NULL DEFAULT '',
  `gc` char(1) NOT NULL DEFAULT '',
  `pointamt` decimal(8,2) NOT NULL DEFAULT '0.00',
  `promoamt` decimal(8,2) NOT NULL DEFAULT '0.00',
  `finished` char(1) NOT NULL DEFAULT '',
  `result` varchar(19) NOT NULL DEFAULT '',
  `auth` varchar(16) NOT NULL DEFAULT '',
  `ref` varchar(16) NOT NULL DEFAULT '',
  `avs` char(2) NOT NULL DEFAULT '',
  `errcount` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `preauthamt` decimal(8,2) NOT NULL DEFAULT '0.00',
  `transid` varchar(10) NOT NULL DEFAULT '',
  `status` char(1) NOT NULL DEFAULT '0',
  `cc1sent` char(1) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `ccnotes` tinytext NOT NULL,
  `cvv2` char(2) NOT NULL DEFAULT '',
  `sentdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `billcompany` varchar(80) NOT NULL DEFAULT '',
  `shipcompany` varchar(80) NOT NULL DEFAULT '',
  `diag` text NOT NULL,
  `tracking` varchar(80) NOT NULL DEFAULT '',
  `cancelled` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `orderdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `associate_tracking` varchar(10) NOT NULL DEFAULT '',
  `referer_url` varchar(100) NOT NULL DEFAULT '',
  `affiliate_rate` float(4,2) NOT NULL DEFAULT '0.00',
  `shippedemail` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `gcused` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `billaddress_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `shipaddress_id` int(3) unsigned NOT NULL DEFAULT '0',
  `rush` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `savesettings` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `payment_received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `pending` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `action` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ship_wishlist` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `priority` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `cc_status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `member_discount` decimal(8,2) NOT NULL DEFAULT '0.00',
  `member_discount_percent` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `storecreditamt` decimal(8,2) NOT NULL DEFAULT '0.00',
  `cc_processor` enum('verisign','paradata') NOT NULL DEFAULT 'paradata',
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `member_discount_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `paypal_paid` decimal(8,2) unsigned NOT NULL DEFAULT '0.00',
  `paypal_import` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `special_order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`orderid`),
  UNIQUE KEY `orderid` (`orderid`),
  KEY `finished` (`finished`),
  KEY `status` (`status`),
  KEY `cid` (`cid`),
  KEY `email` (`email`),
  KEY `idx_store` (`sid`),
  KEY `idx_finished_date` (`finished`,`shippeddate`,`orderdate`),
  KEY `idx_paypal_import` (`paypal_import`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=1 COMMENT='InnoDB free: 449536 kB; InnoDB free: 1251328 kB';

CREATE TABLE `orders_promo` (
  `orderid` double NOT NULL DEFAULT '0',
  `code` varchar(20) NOT NULL DEFAULT '',
  `cid` double NOT NULL DEFAULT '0',
  `ispromo` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `finished` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`orderid`,`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `page_blocks` (
  `block_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `block_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `title` varchar(80) NOT NULL DEFAULT '',
  `text` text NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`block_id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;

CREATE TABLE `page_blocks_index_spot` (
  `spot_id` int(10) unsigned NOT NULL DEFAULT '0',
  `block_id` int(10) unsigned NOT NULL DEFAULT '0',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`spot_id`,`block_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `page_blocks_spot` (
  `spot_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `url` varchar(255) NOT NULL DEFAULT '',
  `name` varchar(80) NOT NULL DEFAULT '',
  PRIMARY KEY (`spot_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

CREATE TABLE `payments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderid` bigint(20) unsigned NOT NULL DEFAULT '0',
  `receiptid` int(11) NOT NULL DEFAULT '0',
  `customerid` varchar(50) NOT NULL DEFAULT '',
  `userid` smallint(6) NOT NULL DEFAULT '0',
  `link` int(11) NOT NULL DEFAULT '0',
  `type` varchar(30) NOT NULL DEFAULT '',
  `account` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `expdate` varchar(4) NOT NULL DEFAULT '',
  `origid` varchar(50) NOT NULL DEFAULT '',
  `result` smallint(6) NOT NULL DEFAULT '0',
  `refno` varchar(50) NOT NULL DEFAULT '',
  `extra` varchar(100) NOT NULL DEFAULT '',
  `amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `auth` varchar(50) NOT NULL DEFAULT '',
  `avs` varchar(10) NOT NULL DEFAULT '',
  `done` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `printedtime` datetime DEFAULT NULL,
  `cc_processor` enum('verisign','paradata') NOT NULL DEFAULT 'paradata',
  `ocounting` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `encrypted` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ccleft` tinyint(3) NOT NULL DEFAULT '0',
  `minor_ref` varchar(45) NOT NULL DEFAULT '',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `idx_link` (`link`),
  KEY `idx_orderid` (`orderid`),
  KEY `idx_type` (`type`),
  KEY `idx_done` (`done`)
) ENGINE=InnoDB AUTO_INCREMENT=219571 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 1372160 kB';

CREATE TABLE `picking_carts` (
  `cart_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `created_at` datetime NOT NULL,
  `last_printed_at` datetime NOT NULL,
  PRIMARY KEY (`cart_id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `picking_ticket` (
  `pickingid` varchar(50) NOT NULL DEFAULT '',
  `createdby` smallint(6) unsigned NOT NULL DEFAULT '0',
  `createddate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `totalorders` smallint(5) unsigned DEFAULT '0',
  `totalpieces` smallint(5) unsigned DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `closeddate` datetime DEFAULT NULL,
  `totalpieces_picked` int(10) unsigned NOT NULL DEFAULT '0',
  `picking_speed` decimal(6,2) unsigned NOT NULL DEFAULT '0.00',
  `totaltime` int(10) unsigned NOT NULL DEFAULT '0',
  `totalbuckets` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `other_picked` smallint(5) unsigned NOT NULL DEFAULT '0',
  `being_created` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pickingid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `picking_ticket_bucket_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bucketid` varchar(10) NOT NULL DEFAULT '',
  `orderid` int(10) unsigned NOT NULL DEFAULT '0',
  `action` varchar(10) NOT NULL DEFAULT '',
  `stamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `pickingid` varchar(10) NOT NULL DEFAULT '',
  `bucketname` varchar(5) NOT NULL DEFAULT '',
  `employeeid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=225396 DEFAULT CHARSET=latin1;

CREATE TABLE `picking_ticket_buckets` (
  `bucketid` varchar(20) NOT NULL DEFAULT '',
  `bucketname` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `pickingid` varchar(11) NOT NULL DEFAULT '',
  `orderid` bigint(20) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `old` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `is_sub` tinyint(3) unsigned NOT NULL,
  KEY `idx_pickingid` (`pickingid`),
  KEY `idx_orderid` (`orderid`),
  KEY `idx_bucketid` (`bucketid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='InnoDB free: 10240 kB';

CREATE TABLE `picking_ticket_cart` (
  `cart_id` smallint(5) unsigned NOT NULL,
  `current_pickingid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`cart_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `picking_ticket_creating` (
  `pickingid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `employee_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `buckets_list` text COLLATE utf8_unicode_ci NOT NULL,
  `options` text COLLATE utf8_unicode_ci NOT NULL,
  `date_started` datetime NOT NULL,
  PRIMARY KEY (`pickingid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `picking_ticket_creation_options` (
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `type` tinyint(4) NOT NULL,
  `value` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `picking_ticket_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pickingid` varchar(20) NOT NULL DEFAULT '',
  `orderid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `qty` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `Index_2` (`pickingid`)
) ENGINE=InnoDB AUTO_INCREMENT=1365184 DEFAULT CHARSET=latin1;

CREATE TABLE `picklist` (
  `picklist_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `finished` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`picklist_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `picklist_employee_status` (
  `picklist_id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `last_location` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `last_location_time` datetime NOT NULL,
  PRIMARY KEY (`picklist_id`,`employee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `picklist_products` (
  `picklist_id` int(11) NOT NULL,
  `pid` int(11) NOT NULL,
  `qty` smallint(6) NOT NULL,
  `qty_picked` smallint(6) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`picklist_id`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `po` (
  `po_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `other_id` varchar(50) NOT NULL DEFAULT '',
  `supplier_id` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `total_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `total_products` int(11) NOT NULL DEFAULT '0',
  `total_pieces` int(11) NOT NULL DEFAULT '0',
  `notes` text NOT NULL,
  `short_note` varchar(50) NOT NULL,
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_ordered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_printed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_estin` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`po_id`),
  KEY `idx_supplier` (`supplier_id`),
  KEY `idx_date_created` (`date_created`,`supplier_id`),
  KEY `idx_date_updated` (`date_updated`,`supplier_id`),
  KEY `idx_date_printed` (`date_printed`,`supplier_id`),
  KEY `idx_date_estin` (`date_estin`,`supplier_id`),
  KEY `idx_other_id` (`other_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31665 DEFAULT CHARSET=latin1;

CREATE TABLE `po_notions_send` (
  `po_id` bigint(20) NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  `date_sent` datetime NOT NULL,
  PRIMARY KEY (`po_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `po_products` (
  `po_id` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_each` int(11) NOT NULL DEFAULT '0',
  `cost_each` decimal(10,2) NOT NULL DEFAULT '0.00',
  `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_ordered` date NOT NULL DEFAULT '0000-00-00',
  `is_waiting_receive` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`po_id`,`pid`),
  KEY `po_products_date_ordered_IDX` (`date_ordered`) USING BTREE,
  KEY `po_products_pid_IDX` (`pid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `po_products_for_orders` (
  `po_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `order_id` int(10) unsigned NOT NULL,
  `qty` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`po_id`,`pid`,`order_id`),
  KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_alert` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `email_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_alerts` (
  `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `sid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`id`,`sid`)
) ENGINE=InnoDB AUTO_INCREMENT=37418532 DEFAULT CHARSET=latin1;

CREATE TABLE `product_alerts_settings` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `sid` int(10) unsigned NOT NULL DEFAULT '0',
  `freq` varchar(20) NOT NULL DEFAULT '',
  `method` varchar(20) NOT NULL DEFAULT '',
  `on` varchar(20) NOT NULL DEFAULT 'both',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_allowed_other_shops` (
  `pid` bigint(20) unsigned NOT NULL,
  `is_allowed` tinyint(3) unsigned NOT NULL,
  `allowed_amazon` tinyint(3) unsigned NOT NULL,
  `allowed_walmart` tinyint(3) unsigned NOT NULL,
  `allowed_michaels` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_amazon_add` (
  `pid` int(10) unsigned NOT NULL,
  `error_msg` text COLLATE utf8_unicode_ci NOT NULL,
  `fix_data` text COLLATE utf8_unicode_ci NOT NULL,
  `is_ready` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_amazon_info` (
  `pid` int(10) unsigned NOT NULL,
  `fba_count` smallint(5) unsigned NOT NULL COMMENT 'FBA',
  `fba_use_inventory` tinyint(3) unsigned NOT NULL COMMENT 'FBA',
  `inv_buffer` smallint(5) unsigned NOT NULL,
  `inventory` smallint(5) unsigned DEFAULT NULL,
  `dont_set_price` tinyint(3) unsigned NOT NULL,
  `status` tinyint(3) NOT NULL,
  `shipping_group` tinyint(3) NOT NULL,
  `shipping_group_last_change` datetime NOT NULL,
  `feed_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `update_price` tinyint(3) unsigned NOT NULL,
  `update_inventory` tinyint(3) unsigned NOT NULL,
  `update_shipping_group` tinyint(3) unsigned NOT NULL,
  `is_correct` tinyint(3) NOT NULL,
  `no_match_found_at` datetime NOT NULL,
  PRIMARY KEY (`pid`),
  KEY `feed_id` (`feed_id`),
  KEY `no_match_found_at` (`no_match_found_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_amazon_other_id` (
  `amz_sku` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `itemnumber` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`amz_sku`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_backorders` (
  `pid` int(10) NOT NULL,
  `supplier` smallint(6) NOT NULL,
  `qty` smallint(6) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`,`supplier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_cali_prop_65_messages` (
  `pid` int(10) unsigned NOT NULL,
  `msg_type` tinyint(4) NOT NULL,
  `materials` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `cause_cancer` tinyint(4) NOT NULL,
  `cause_birth_defects` tinyint(4) NOT NULL,
  `cause_reproductive_harm` tinyint(4) NOT NULL,
  `url_part` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `raw_original_msg` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_categories` (
  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
  `master_cat_id` int(11) NOT NULL,
  `old_store_folder_id` int(11) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `combined_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `hidden` tinyint(3) unsigned NOT NULL,
  `no_narrow` tinyint(3) unsigned NOT NULL,
  `show_notify_option` tinyint(3) unsigned NOT NULL,
  `private` tinyint(3) unsigned NOT NULL,
  `tax_code_id` int(10) unsigned NOT NULL,
  `other_not_allowed` tinyint(3) unsigned NOT NULL,
  `allow_sell_amazon` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `allow_sell_others` tinyint(3) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`cat_id`),
  KEY `name` (`name`),
  KEY `master_cat_id` (`master_cat_id`),
  KEY `type` (`type`,`cat_id`),
  KEY `combined_name` (`combined_name`)
) ENGINE=InnoDB AUTO_INCREMENT=26551 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_category_index` (
  `cat_id` int(11) NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  PRIMARY KEY (`cat_id`,`pid`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_category_index_simple_list` (
  `pid` int(10) unsigned NOT NULL,
  `cat_type` tinyint(3) unsigned DEFAULT NULL,
  `list` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_category_landing_extras` (
  `cat_id` int(11) NOT NULL,
  `sid` int(11) NOT NULL,
  `section_cat_id` int(11) NOT NULL,
  `extra_id` mediumint(9) NOT NULL,
  `image` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `extra_cat_id` int(11) NOT NULL,
  `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `top_text` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `order` mediumint(9) NOT NULL,
  `hidden` tinyint(4) NOT NULL,
  `is_new` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cat_id`,`sid`,`section_cat_id`,`extra_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_category_landings` (
  `cat_id` int(11) NOT NULL,
  `sid` int(11) NOT NULL,
  `section_cat_id` int(11) NOT NULL,
  `image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `content` text COLLATE utf8_unicode_ci NOT NULL,
  `sort_by` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `image_pos` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'left',
  `rotate_extras` tinyint(4) unsigned NOT NULL,
  `random_extras` tinyint(4) unsigned NOT NULL,
  `style_extras` tinyint(4) unsigned NOT NULL,
  `hide_product_list` tinyint(4) unsigned NOT NULL,
  `rows_extra` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`cat_id`,`sid`,`section_cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_category_links` (
  `cat_id1` int(11) NOT NULL,
  `cat_id2` int(11) NOT NULL,
  PRIMARY KEY (`cat_id1`,`cat_id2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_category_renames` (
  `rename_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `old_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `new_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `cat_id` int(11) NOT NULL,
  `type` int(11) NOT NULL,
  PRIMARY KEY (`rename_id`),
  KEY `type` (`type`,`old_name`)
) ENGINE=InnoDB AUTO_INCREMENT=330 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_cats` (
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `cat_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '1=type;2=theme',
  `sub_level` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`pid`),
  KEY `idx_pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_cats_list` (
  `pid` int(10) NOT NULL,
  `cat_type` tinyint(4) NOT NULL,
  `list` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`pid`,`cat_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_color_idx` (
  `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `color` varchar(6) NOT NULL DEFAULT '',
  `weight` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`color`),
  KEY `idx_color` (`color`,`weight`,`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=48725 DEFAULT CHARSET=latin1;

CREATE TABLE `product_color_idx2` (
  `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `color` smallint(5) unsigned NOT NULL DEFAULT '0',
  `weight` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`color`),
  KEY `idx_color` (`color`)
) ENGINE=InnoDB AUTO_INCREMENT=49989 DEFAULT CHARSET=latin1;

CREATE TABLE `product_color_list` (
  `color` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL DEFAULT '',
  `hex_color` varchar(6) NOT NULL DEFAULT '',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`color`)
) ENGINE=InnoDB AUTO_INCREMENT=16777215 DEFAULT CHARSET=latin1;

CREATE TABLE `product_colors` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `color` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `weight` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`color`) USING BTREE,
  KEY `color` (`color`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_current_prices` (
  `price_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL,
  `qty_buy` smallint(5) unsigned NOT NULL,
  `is_min_qty_buy` tinyint(3) unsigned NOT NULL,
  `price_each` decimal(10,3) unsigned NOT NULL,
  `qty_limit` smallint(5) unsigned NOT NULL,
  `no_promo` tinyint(3) unsigned NOT NULL,
  `checkout_offer` tinyint(3) unsigned NOT NULL,
  `active` tinyint(3) unsigned NOT NULL,
  `date_active` datetime NOT NULL,
  `date_deactive` datetime NOT NULL,
  PRIMARY KEY (`price_id`),
  KEY `pid` (`pid`,`active`,`qty_buy`),
  KEY `checkout_offer` (`checkout_offer`,`active`),
  KEY `date_deactive` (`date_deactive`,`active`),
  KEY `date_active` (`date_active`,`active`)
) ENGINE=InnoDB AUTO_INCREMENT=3007123 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_daily_deals` (
  `deal_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `deal_date` date NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `price_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`deal_id`),
  KEY `deal_date` (`deal_date`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=311724 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `filename` varchar(80) NOT NULL DEFAULT '',
  `size` int(10) unsigned NOT NULL DEFAULT '0',
  `amazon_archive_id` varchar(255) NOT NULL DEFAULT '',
  `added_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24871 DEFAULT CHARSET=latin1;

CREATE TABLE `product_ignore_missing_info` (
  `pid` int(10) unsigned NOT NULL,
  `info_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_ignore_missings` (
  `pid` int(10) unsigned NOT NULL,
  `info_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`info_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_images` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `iid` smallint(5) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '255=default',
  `width` smallint(5) unsigned NOT NULL DEFAULT '0',
  `height` smallint(3) unsigned NOT NULL DEFAULT '0',
  `hidden` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`,`type`,`iid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `product_images_sha1` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `iid` int(10) NOT NULL DEFAULT '0',
  `sha1` varchar(40) CHARACTER SET latin1 DEFAULT NULL,
  PRIMARY KEY (`pid`,`iid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_import_images` (
  `pid` int(10) unsigned NOT NULL,
  `image_url` varchar(200) CHARACTER SET utf8 NOT NULL,
  `is_finished` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`pid`,`image_url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `product_inventory` (
  `itemnumber` varchar(40) NOT NULL DEFAULT '',
  `daterec` date NOT NULL DEFAULT '0000-00-00',
  `count` smallint(6) NOT NULL DEFAULT '0',
  `qty_fraction_numerator` tinyint(4) NOT NULL DEFAULT '0',
  `qty_fraction_denominator` tinyint(4) NOT NULL DEFAULT '0',
  `costeach` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `orig_costeach` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `poid` int(10) unsigned NOT NULL DEFAULT '0',
  `receiving_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `itemnumber` (`itemnumber`),
  KEY `daterec` (`daterec`),
  KEY `idx_pid` (`pid`),
  KEY `Index_4` (`itemnumber`,`daterec`,`costeach`)
) ENGINE=InnoDB AUTO_INCREMENT=886707 DEFAULT CHARSET=latin1;

CREATE TABLE `product_inventory_cost_change_log` (
  `change_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `query` text COLLATE utf8_unicode_ci NOT NULL,
  `note` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `items_changed` mediumint(8) unsigned NOT NULL,
  `value_changed` decimal(10,3) unsigned NOT NULL,
  `percent_reduced` tinyint(3) unsigned NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`change_id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_inventory_cost_change_log_items` (
  `change_id` int(10) unsigned NOT NULL,
  `pi_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `old_cost` decimal(10,5) unsigned NOT NULL,
  `new_cost` decimal(10,5) unsigned NOT NULL,
  `inventory` smallint(5) unsigned NOT NULL,
  PRIMARY KEY (`change_id`,`pi_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_inventory_manual_change` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `date` date NOT NULL DEFAULT '0000-00-00',
  `change` smallint(6) NOT NULL DEFAULT '0',
  `value_change` decimal(10,4) NOT NULL DEFAULT '0.0000',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`,`date`),
  KEY `date` (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_last_sold` (
  `pid` int(10) unsigned NOT NULL,
  `store` tinyint(3) unsigned NOT NULL,
  `date_sold` date NOT NULL,
  PRIMARY KEY (`pid`,`store`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_last_verification` (
  `pid` int(10) unsigned NOT NULL,
  `field` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`pid`,`field`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_location_changes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL,
  `old_location` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `new_location` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `by_cid` int(10) unsigned NOT NULL,
  `changed_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=48387 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_media` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `url` varchar(200) NOT NULL DEFAULT '',
  `title` varchar(255) NOT NULL DEFAULT '',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `code` varchar(255) NOT NULL DEFAULT '',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`id`) USING BTREE,
  KEY `idx_pid_type` (`pid`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `product_michaels_info` (
  `pid` int(10) unsigned NOT NULL,
  `sku` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL,
  `update_price` tinyint(3) unsigned NOT NULL,
  `update_inventory` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_michaels_taxonomy` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `path` text COLLATE utf8_unicode_ci NOT NULL,
  `name` text COLLATE utf8_unicode_ci NOT NULL,
  `our_cat_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `product_michaels_taxonomy_our_cat_id_IDX` (`our_cat_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4452 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_notify` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `sid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`pid`,`sid`),
  KEY `idx_pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `product_notify_last_products` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `product_notify_store_folder` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `store_folder_id` int(10) unsigned NOT NULL DEFAULT '0',
  `options` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`store_folder_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_notify_to_email` (
  `sending` int(10) NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `new` tinyint(4) NOT NULL,
  `store_folder_id` int(4) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`pid`,`sending`),
  KEY `sending` (`sending`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_notions` (
  `pid` int(10) unsigned NOT NULL,
  `abc_score` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `sell_qty` smallint(6) NOT NULL DEFAULT '0',
  `sell_cost` decimal(10,2) NOT NULL DEFAULT '0.00',
  `csc` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `csc1` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `csc2` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `csc3` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `inventory` smallint(5) unsigned NOT NULL DEFAULT '0',
  `use_inventory` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `buffer` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_discontinued` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order_qty_conversion_our` tinyint(3) NOT NULL DEFAULT '1',
  `order_qty_conversion_notions` tinyint(3) NOT NULL DEFAULT '1',
  `force_update_description` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `force_update_image` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `force_update_dims` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `force_update_weight` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `force_update_price` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `dont_update_map` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `last_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `top_seller` smallint(5) unsigned NOT NULL DEFAULT '0',
  `no_marketplace_selling` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `investigate` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `data_error` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`),
  KEY `csc` (`csc`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_notions_b2b` (
  `pid` int(10) unsigned NOT NULL,
  `inventory` smallint(5) unsigned NOT NULL DEFAULT '0',
  `use_inventory` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_updated` datetime NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_notions_created` (
  `pid` int(10) unsigned NOT NULL,
  `imported_at` datetime NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_offers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `date_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_end` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `price` decimal(7,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `qty` int(10) unsigned NOT NULL DEFAULT '0',
  `show_always` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `qty_max` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `Index_2` (`date_start`,`date_end`,`active`)
) ENGINE=InnoDB AUTO_INCREMENT=1510 DEFAULT CHARSET=latin1;

CREATE TABLE `product_offers_uses` (
  `product_offer_id` int(11) unsigned NOT NULL,
  `order_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`product_offer_id`,`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_onorder_ignore` (
  `pid` int(10) unsigned NOT NULL,
  `po_r_id` int(10) unsigned NOT NULL,
  `just_ordered` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`pid`,`po_r_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_onpreorder_changes` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `pid` bigint(20) unsigned NOT NULL,
  `date_changed` datetime NOT NULL,
  `changed_by_cid` bigint(20) unsigned NOT NULL,
  `new_value` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_onpreorder_changes_pid_IDX` (`pid`,`date_changed`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8528 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_other_kinds` (
  `other_kind_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `label` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `image_pick` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`other_kind_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3293 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_other_kinds_products` (
  `other_kind_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `ordering` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`other_kind_id`,`pid`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_prices` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `price_locked` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `price_min` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `last_price_update` datetime NOT NULL,
  PRIMARY KEY (`pid`,`store`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_prices_other` (
  `pid` int(10) unsigned NOT NULL,
  `price_source` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `is_our_price` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `date_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`pid`,`price_source`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_query` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_name` text NOT NULL,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL DEFAULT '',
  `locked` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=49989 DEFAULT CHARSET=latin1;

CREATE TABLE `product_query_filter` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `query_id` int(10) unsigned NOT NULL DEFAULT '0',
  `filter_type` varchar(50) NOT NULL DEFAULT '',
  `filter_text1` varchar(90) NOT NULL DEFAULT '',
  `filter_text2` varchar(90) NOT NULL DEFAULT '',
  `filter_operator` varchar(20) NOT NULL DEFAULT '',
  `filter_description` varchar(255) NOT NULL DEFAULT '',
  `filter_combine_same` varchar(5) NOT NULL DEFAULT 'OR',
  `filter_combine_different` varchar(5) NOT NULL DEFAULT 'AND',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=283505 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 157696 kB';

CREATE TABLE `product_related` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `to_pid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`to_pid`,`type`),
  KEY `idx_to_pid` (`to_pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_reviews` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `verified` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `rating` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `review_text` text NOT NULL,
  `date_added` date NOT NULL DEFAULT '0000-00-00',
  `reply` text NOT NULL,
  `reply_date` date NOT NULL,
  `sa_id` int(10) unsigned NOT NULL COMMENT 'Shopper Approved Product Review ID',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `review_order_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product_reviews_pending` (
  `cid` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `added_at` datetime NOT NULL,
  PRIMARY KEY (`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_score_data` (
  `pid` int(11) NOT NULL,
  `date` date NOT NULL,
  `buyable` tinyint(4) NOT NULL,
  `sold_total` smallint(5) unsigned NOT NULL,
  `sold_times` smallint(5) unsigned NOT NULL,
  PRIMARY KEY (`pid`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_stat_history` (
  `pid` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `score` decimal(10,2) NOT NULL,
  `score2` decimal(10,2) NOT NULL,
  `qty_in_baskets` smallint(6) NOT NULL,
  `qty_sold` smallint(6) NOT NULL,
  `notifies_set` smallint(6) NOT NULL,
  `visibility_score` decimal(10,2) NOT NULL,
  `health_score` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `sold_view_score` decimal(6,3) NOT NULL,
  KEY `product_stat_history_pid_IDX` (`pid`,`date`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_storefront` (
  `pid` int(10) unsigned NOT NULL,
  `count` smallint(6) NOT NULL,
  `price` decimal(10,2) unsigned NOT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_tax_codes` (
  `tax_code_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `mi_taxable` tinyint(4) NOT NULL DEFAULT '1',
  `value_taxjar` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`tax_code_id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_todo` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL,
  `date_added` datetime NOT NULL,
  `added_by_cid` int(10) unsigned NOT NULL,
  `todo_type` tinyint(3) unsigned NOT NULL,
  `is_done` tinyint(3) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `pid` (`pid`),
  KEY `todo_type` (`todo_type`,`is_done`)
) ENGINE=InnoDB AUTO_INCREMENT=156865 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `product_walmart_info` (
  `pid` int(10) unsigned NOT NULL,
  `status` tinyint(3) NOT NULL,
  `update_price` tinyint(3) unsigned NOT NULL,
  `update_inventory` tinyint(3) unsigned NOT NULL,
  `feed_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `errors` text COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `products` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `itemnumber` varchar(20) NOT NULL DEFAULT '',
  `upc` varchar(30) NOT NULL DEFAULT '',
  `upc_2` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(100) NOT NULL DEFAULT '' COMMENT 'Name',
  `notes` text NOT NULL COMMENT 'Description',
  `description_short` varchar(255) NOT NULL DEFAULT '',
  `notes2` text NOT NULL COMMENT 'Description 2',
  `sellingprice` decimal(7,2) NOT NULL DEFAULT '0.00' COMMENT 'Default Price',
  `price_for_sort` decimal(7,2) NOT NULL DEFAULT '0.00',
  `salepercent_for_sort` decimal(4,3) NOT NULL DEFAULT '0.000',
  `currentsaleprice` decimal(7,2) NOT NULL DEFAULT '0.00' COMMENT 'old',
  `sale` decimal(4,3) NOT NULL DEFAULT '0.000' COMMENT 'old',
  `price_notes` varchar(100) NOT NULL DEFAULT '',
  `price_other` decimal(7,2) unsigned NOT NULL DEFAULT '0.00',
  `minimum_advertised_price` decimal(7,2) unsigned NOT NULL DEFAULT '0.00',
  `msrp` decimal(7,2) unsigned NOT NULL DEFAULT '0.00',
  `price_lock` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `keyword1` varchar(150) NOT NULL DEFAULT '',
  `priv_notes` mediumtext,
  `location` varchar(10) NOT NULL DEFAULT '',
  `aisle` varchar(3) NOT NULL DEFAULT '',
  `rack` varchar(4) NOT NULL DEFAULT '',
  `hook` varchar(10) NOT NULL DEFAULT '',
  `score` decimal(10,2) DEFAULT '0.00',
  `score2` decimal(10,2) NOT NULL DEFAULT '0.00',
  `visibility_score` decimal(10,2) NOT NULL DEFAULT '0.00',
  `health_score` varchar(5) NOT NULL DEFAULT '',
  `sold_view_score` decimal(6,3) NOT NULL DEFAULT '0.000',
  `shipping_tier` tinyint(3) NOT NULL DEFAULT '1',
  `discontinued` varchar(2) DEFAULT '',
  `discontinuedate` date NOT NULL DEFAULT '0000-00-00',
  `nottaxable` tinyint(4) DEFAULT '0',
  `tax_code` int(10) unsigned NOT NULL DEFAULT '0',
  `size` varchar(60) NOT NULL DEFAULT '',
  `size_cat` int(10) unsigned NOT NULL DEFAULT '0',
  `currentsaleprice_percent` double(30,2) NOT NULL DEFAULT '0.00',
  `wholesale_unit_qty` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `wholesale_discount` double(30,2) unsigned NOT NULL DEFAULT '0.30',
  `hide` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `hide_in_shop` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `notnew` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `expected` date DEFAULT '0000-00-00',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `datein` datetime DEFAULT '0000-00-00 00:00:00',
  `date_refill` datetime DEFAULT '0000-00-00 00:00:00',
  `date_ol` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `imagein` datetime DEFAULT '0000-00-00 00:00:00',
  `defaultcosteach` decimal(10,2) NOT NULL DEFAULT '0.00',
  `weight` decimal(10,2) NOT NULL DEFAULT '0.00',
  `length` decimal(8,3) NOT NULL DEFAULT '0.000',
  `width` decimal(8,3) NOT NULL DEFAULT '0.000',
  `height` decimal(8,3) NOT NULL DEFAULT '0.000',
  `harmonized_tariff_code` varchar(10) NOT NULL DEFAULT '',
  `store` smallint(5) unsigned NOT NULL DEFAULT '0',
  `company` int(10) unsigned NOT NULL DEFAULT '0',
  `line` int(10) unsigned NOT NULL DEFAULT '0',
  `subline` int(10) unsigned NOT NULL DEFAULT '0',
  `type` int(10) unsigned NOT NULL DEFAULT '0',
  `subtype` int(10) unsigned NOT NULL DEFAULT '0',
  `investorid` int(10) unsigned NOT NULL DEFAULT '0',
  `artist` int(10) unsigned NOT NULL DEFAULT '0',
  `totalsold` int(10) unsigned NOT NULL DEFAULT '0',
  `reorder` tinyint(3) NOT NULL DEFAULT '0',
  `min_qty_wanted` smallint(5) unsigned NOT NULL DEFAULT '0',
  `qty_bundled` smallint(5) unsigned NOT NULL DEFAULT '0',
  `dimension` int(10) unsigned NOT NULL DEFAULT '0',
  `media` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `downloadable` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ct_free` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `exclusive` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ctd_free` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `lock_qty` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `usa_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `shipping_restrictions` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `no_puffy` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `country_of_origin` varchar(5) NOT NULL DEFAULT '',
  `handling_fee` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'In oz',
  `no_40_percent_promo` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `rating` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `rating_votes` int(10) unsigned NOT NULL DEFAULT '0',
  `preorder_fee` decimal(6,2) NOT NULL DEFAULT '0.00',
  `not_clearance` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `not_backinstock` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `special_item` int(10) unsigned NOT NULL DEFAULT '0',
  `points_multiplier` decimal(6,3) unsigned NOT NULL DEFAULT '1.000',
  `points_bonus` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `parent_pid` int(10) unsigned NOT NULL DEFAULT '0',
  `sub_name` varchar(80) NOT NULL DEFAULT '',
  `sub_order` varchar(5) NOT NULL DEFAULT 'val',
  `large` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `show_notify` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `force_flag` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `related_to_show` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `exclude_google_feed` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stat_stop` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `cali_prop_65` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_priority_ship_item` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`),
  KEY `idx_sale` (`currentsaleprice`),
  KEY `description` (`description`),
  KEY `idx_datein` (`datein`),
  KEY `idx_daterefill` (`date_refill`),
  KEY `idx_imagein` (`imagein`),
  KEY `idx_salepercent` (`currentsaleprice_percent`),
  KEY `idx_hide` (`hide`),
  KEY `idx_itemnumber` (`itemnumber`),
  KEY `idx_stamp` (`stamp`),
  KEY `idx_artist` (`artist`),
  KEY `idx_dimension` (`dimension`),
  KEY `idx_company` (`company`,`hide`) USING BTREE,
  KEY `idx_line` (`line`),
  KEY `idx_test3` (`type`,`hide`,`store`,`description`),
  KEY `idxscore` (`score`),
  KEY `idx_sellingprice` (`sellingprice`),
  KEY `idx_investorid` (`investorid`),
  KEY `idx_hideinshop` (`hide_in_shop`),
  KEY `idx_location` (`aisle`,`rack`,`hook`),
  KEY `Index_prod_test` (`notnew`,`hide`,`hide_in_shop`,`store`,`date_ol`,`description`),
  KEY `idx_load` (`pid`,`company`,`line`,`subline`,`artist`),
  KEY `idx_parent` (`parent_pid`) USING BTREE,
  KEY `idx_test2` (`hide`,`hide_in_shop`,`store`,`pid`) USING BTREE,
  KEY `idx_upc` (`upc`),
  KEY `idx_shop_new` (`pid`,`date_ol`,`notnew`,`store`),
  KEY `idx_subline` (`subline`),
  KEY `upc_2` (`upc_2`),
  KEY `price_for_sort` (`price_for_sort`),
  KEY `salepercent_for_sort` (`salepercent_for_sort`),
  KEY `stat_stop` (`stat_stop`),
  KEY `products_date_ol_IDX` (`date_ol`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `products_otherid` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `id` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `store` tinyint(50) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`),
  KEY `idx_id` (`id`),
  KEY `idx_look` (`store`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `products_pricetemp` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `offer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `price` double(10,2) unsigned NOT NULL DEFAULT '0.00',
  `no_promo` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `qty_limit` tinyint(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`offer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `products_rating` (
  `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `rating` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`,`cid`),
  KEY `Index_2` (`pid`,`rating`)
) ENGINE=InnoDB AUTO_INCREMENT=9005642 DEFAULT CHARSET=latin1;

CREATE TABLE `promo_other_data` (
  `promo_id` int(10) unsigned NOT NULL,
  `data_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `data_value` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`promo_id`,`data_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `promo_stats` (
  `promo_id` int(10) unsigned NOT NULL,
  `used` mediumint(9) NOT NULL,
  `order_subtotal` decimal(10,2) NOT NULL,
  `order_total` decimal(10,2) NOT NULL,
  `order_profit` decimal(10,2) NOT NULL,
  `total_discounted` decimal(10,2) NOT NULL,
  PRIMARY KEY (`promo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `promo_uses` (
  `promo_id` int(11) NOT NULL DEFAULT '0',
  `discount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `count` mediumint(9) NOT NULL DEFAULT '0',
  PRIMARY KEY (`promo_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `promos` (
  `promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  `promo_code` varchar(30) NOT NULL DEFAULT '',
  `promo_description_private` text NOT NULL,
  `promo_description_online` text NOT NULL,
  `promo_investor_id` int(10) unsigned NOT NULL,
  `promo_active` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `date_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_end` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `subtotal_min` decimal(7,2) NOT NULL DEFAULT '0.00',
  `store` int(11) NOT NULL DEFAULT '0',
  `with_points` tinyint(1) NOT NULL DEFAULT '0',
  `is_reusable` tinyint(1) NOT NULL DEFAULT '0',
  `other_promos` tinyint(1) NOT NULL DEFAULT '0',
  `force_allow` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `available_to` int(11) NOT NULL DEFAULT '0',
  `max_discount` decimal(7,2) NOT NULL DEFAULT '0.00',
  `for_order_type` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `is_advertising` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `is_auto` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `is_for_copying` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `auto_type` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `for_newsletter_id` int(11) unsigned NOT NULL DEFAULT '0',
  `for_sending_id` int(11) unsigned NOT NULL DEFAULT '0',
  `not_other_products` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `is_published` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `published_date_start` datetime NOT NULL,
  `published_date_end` datetime NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`promo_id`),
  KEY `idx_date` (`date_start`,`date_end`),
  KEY `idx_code` (`promo_code`),
  KEY `idx_investor` (`promo_investor_id`),
  KEY `Index_5` (`promo_id`,`date_start`,`date_end`,`is_auto`),
  KEY `Index_6` (`promo_id`,`date_end`,`is_auto`),
  KEY `is_auto` (`is_auto`),
  KEY `is_published` (`is_published`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `promos_auto` (
  `promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  `subtotal_min` decimal(7,2) NOT NULL DEFAULT '0.00',
  `subtotal_max` decimal(7,2) NOT NULL DEFAULT '0.00',
  `date_start` datetime DEFAULT NULL,
  `date_end` datetime DEFAULT NULL,
  `type` tinyint(4) NOT NULL DEFAULT '0',
  `must_contain` int(11) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`promo_id`),
  KEY `idx_date_placed` (`date_start`,`date_end`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `promos_discounts` (
  `promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `amount` decimal(7,2) NOT NULL DEFAULT '0.00',
  `percent` tinyint(4) NOT NULL DEFAULT '0',
  `which_price` tinyint(1) NOT NULL DEFAULT '0',
  `query_id1` int(11) NOT NULL DEFAULT '0',
  `query_id2` int(11) NOT NULL DEFAULT '0',
  `query_qty1` int(11) NOT NULL DEFAULT '0',
  `query_qty2` int(11) NOT NULL DEFAULT '0',
  `query_amount1` decimal(7,2) NOT NULL DEFAULT '0.00',
  `query_amount2` decimal(7,2) NOT NULL DEFAULT '0.00',
  `query_which1` tinyint(4) NOT NULL DEFAULT '0',
  `query_which2` tinyint(4) NOT NULL DEFAULT '0',
  `target` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `subtotal_min` decimal(7,2) NOT NULL DEFAULT '0.00',
  `real_subtotal_from` decimal(7,2) NOT NULL DEFAULT '0.00',
  `real_subtotal_to` decimal(7,2) NOT NULL DEFAULT '0.00',
  `subtotal_not_including_required` tinyint(4) NOT NULL DEFAULT '0',
  `max_discount` decimal(7,2) NOT NULL DEFAULT '0.00',
  `valid_from` datetime DEFAULT NULL,
  `valid_to` datetime DEFAULT NULL,
  `max_times` smallint(10) unsigned DEFAULT NULL,
  `exclude_other` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `req_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `req_qty` smallint(6) NOT NULL,
  `req_amount` decimal(7,2) NOT NULL,
  `req_query_id` int(11) NOT NULL,
  `req2_qty` smallint(6) NOT NULL,
  `req2_amount` decimal(7,2) NOT NULL,
  `req2_query_id` int(11) NOT NULL,
  `req_discountable` tinyint(4) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`promo_id`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `promos_users` (
  `promo_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`promo_id`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `rate_examples` (
  `weight` smallint(6) NOT NULL,
  `location` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `method` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
  `rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `cost` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`weight`,`location`,`method`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `receivings` (
  `receiving_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `po_id` int(10) unsigned NOT NULL DEFAULT '0',
  `other_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `invoice_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `packinglist_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `supplier_id` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  `shipping` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `total_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `total_products` int(10) unsigned NOT NULL DEFAULT '0',
  `total_pieces` int(10) unsigned NOT NULL DEFAULT '0',
  `hold` tinyint(4) NOT NULL DEFAULT '0',
  `for_storefront` tinyint(4) NOT NULL DEFAULT '0',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_paid` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_checked` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`receiving_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31666 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `receivings_adjustments_journal` (
  `journal_id` int(10) unsigned NOT NULL,
  `receiving_id` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `journal_date` datetime NOT NULL,
  `item_value_change` decimal(10,3) NOT NULL,
  `item_qty` smallint(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `receivings_products` (
  `receiving_id` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_each_orig` smallint(6) NOT NULL DEFAULT '0',
  `qty_each` smallint(6) NOT NULL DEFAULT '0',
  `cost_each_orig` decimal(10,2) NOT NULL DEFAULT '0.00',
  `cost_each` decimal(10,5) NOT NULL DEFAULT '0.00000',
  `received_by` smallint(3) NOT NULL DEFAULT '0',
  `received_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`receiving_id`,`pid`),
  KEY `received_date` (`received_date`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `replicate_files` (
  `server` varchar(45) NOT NULL DEFAULT '',
  `new_file_loc` varchar(80) NOT NULL DEFAULT '',
  `final_file_loc` varchar(80) NOT NULL DEFAULT '',
  `user` varchar(45) NOT NULL DEFAULT '',
  `pass` varchar(20) NOT NULL DEFAULT '',
  `ip` varchar(45) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `enabled` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `receive_enabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `local_copy` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`server`,`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `report_sales_data` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `date_change` datetime NOT NULL,
  `order_id` int(11) NOT NULL,
  `action` tinyint(4) NOT NULL COMMENT '1=placed, 2=change, 3=cancel, 4=po change',
  `sale_amount` decimal(10,2) NOT NULL,
  `refund_amount` decimal(10,2) NOT NULL,
  `gc_sale_amount` decimal(10,2) NOT NULL,
  `gc_used_amount` decimal(10,2) NOT NULL,
  `shipping_collected_amount` decimal(10,2) NOT NULL,
  `small_order_fee_amount` decimal(10,2) NOT NULL,
  `rush_fee_amount` decimal(10,2) NOT NULL,
  `discount_total_amount` decimal(10,2) NOT NULL,
  `discount_only_shipping_amount` decimal(10,2) NOT NULL,
  `tax_collected_amount` decimal(10,2) NOT NULL,
  `cogs_amount` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `order_id` (`order_id`),
  KEY `date_change` (`date_change`)
) ENGINE=InnoDB AUTO_INCREMENT=1677020 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `report_sales_data_order_last` (
  `order_id` int(10) unsigned NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `scraped_notions` (
  `notions_itemnumber` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`notions_itemnumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `search_autocomplete` (
  `name` varchar(50) NOT NULL DEFAULT '',
  `store` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`name`,`store`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `search_browse` (
  `cat_id` int(10) unsigned NOT NULL,
  `type` smallint(3) NOT NULL DEFAULT '0',
  `name` varchar(50) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `display_name` varchar(50) NOT NULL DEFAULT '',
  `full_name` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `path` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `stamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`type`,`name`,`full_name`),
  KEY `name` (`name`),
  KEY `full_name` (`full_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `search_helper` (
  `search` varchar(100) NOT NULL DEFAULT '',
  `strength` tinyint(3) unsigned DEFAULT NULL,
  `code1` varchar(100) DEFAULT NULL,
  `code2` varchar(100) DEFAULT NULL,
  `code3` varchar(100) DEFAULT NULL,
  `stamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`search`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `search_history` (
  `search` varchar(50) NOT NULL DEFAULT '',
  `uid` varchar(20) NOT NULL DEFAULT '',
  `when` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`search`,`uid`),
  KEY `idx_when` (`when`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `search_sphinx_results` (
  `query_md5` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `ordering` smallint(5) unsigned NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`query_md5`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `search_sphinx_wordforms` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `word_from` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `word_to` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `ship_time` (
  `type` varchar(40) NOT NULL DEFAULT '',
  `zone` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `min_time` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `max_time` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`type`,`zone`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `shipping_days` (
  `date` date NOT NULL,
  `dtype` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`date`,`dtype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shipping_system_options` (
  `option` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `value` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`option`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_buyable_history` (
  `pid` int(11) unsigned NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`pid`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_history` (
  `pid` int(10) unsigned NOT NULL,
  `added_datetime` datetime NOT NULL,
  `avail_to_buy` smallint(6) NOT NULL DEFAULT '0',
  KEY `added_date` (`added_datetime`),
  KEY `pid` (`pid`,`added_datetime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_inventory` (
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(10) unsigned NOT NULL DEFAULT '0',
  `show` tinyint(10) unsigned NOT NULL DEFAULT '0',
  `buyable` tinyint(10) unsigned NOT NULL DEFAULT '0',
  `available` mediumint(10) NOT NULL DEFAULT '0',
  `available_local` mediumint(10) NOT NULL DEFAULT '0',
  `pending` mediumint(10) NOT NULL DEFAULT '0',
  `all` tinyint(10) DEFAULT '0',
  `inventory_source` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pid`,`store`),
  KEY `idx_show` (`store`,`show`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `shop_menu` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `published_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `cat_id` int(10) NOT NULL,
  `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `subtype` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `tab` smallint(5) unsigned NOT NULL DEFAULT '0',
  `column` smallint(5) unsigned NOT NULL DEFAULT '0',
  `ordering` smallint(5) unsigned NOT NULL DEFAULT '0',
  `auto_add_count` tinyint(3) unsigned NOT NULL,
  `auto_group_by` tinyint(3) unsigned NOT NULL,
  `auto_pick_by` tinyint(3) unsigned NOT NULL,
  `auto_sort_by` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `store` (`store`),
  KEY `published_menu_id` (`published_menu_id`)
) ENGINE=InnoDB AUTO_INCREMENT=38335 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_menu_rendered` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `published_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(3) unsigned NOT NULL,
  `active` tinyint(3) unsigned NOT NULL,
  `shop_menu_html` text COLLATE utf8_unicode_ci NOT NULL,
  `mobile_menu_html` text COLLATE utf8_unicode_ci NOT NULL,
  `sections` text COLLATE utf8_unicode_ci NOT NULL,
  `date_published` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `store` (`store`,`active`),
  KEY `published_menu_id` (`published_menu_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2260 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_page_errors` (
  `url` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `url_referral` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `date_viewed` date NOT NULL,
  `viewed_count` smallint(6) NOT NULL,
  PRIMARY KEY (`date_viewed`,`url`,`url_referral`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_page_moved` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `url_part_from` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `url_part_to` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `store` tinyint(3) unsigned NOT NULL,
  `last_used` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `store` (`store`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_settings` (
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `value` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shop_shown_history` (
  `pid` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`pid`,`date`),
  KEY `date` (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shortlinks` (
  `shortlink_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `type` tinyint(3) unsigned NOT NULL,
  `extra_data` text COLLATE utf8_unicode_ci NOT NULL,
  `short_part` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `url_full` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `date_created` datetime NOT NULL,
  PRIMARY KEY (`shortlink_id`)
) ENGINE=InnoDB AUTO_INCREMENT=61152 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `shortlinks_visits` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `shortlink_id` bigint(20) unsigned NOT NULL,
  `visit_at` datetime NOT NULL,
  `ip_address` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `user_agent` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `is_bot_click` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `shortlinks_visits_shortlink_id_IDX` (`shortlink_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=9607 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `site_comments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
  `text` text NOT NULL,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`topic_id`),
  KEY `cid` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=18445 DEFAULT CHARSET=latin1;

CREATE TABLE `site_folders` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `master` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(80) NOT NULL DEFAULT '',
  `description` text NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `topic_count` smallint(5) unsigned NOT NULL DEFAULT '0',
  `subfolder_count` smallint(5) unsigned NOT NULL DEFAULT '0',
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`sid`),
  KEY `idx_master` (`master`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=latin1;

CREATE TABLE `snap_product_summary` (
  `date` date NOT NULL DEFAULT '0000-00-00',
  `ct` bigint(21) NOT NULL DEFAULT '0',
  `value` double(20,3) DEFAULT NULL,
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `snap_product_value` (
  `date` date NOT NULL DEFAULT '0000-00-00',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `count` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `pending` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `value` decimal(10,3) NOT NULL DEFAULT '0.000',
  PRIMARY KEY (`date`,`pid`),
  KEY `idx_pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `snap_ready` (
  `snap_dt` datetime NOT NULL,
  `orders_ready_to_pick` smallint(6) NOT NULL,
  `picking_tickets_makeable` smallint(6) NOT NULL,
  `oldest_date_ready` datetime NOT NULL,
  `order_count_notions_todo` smallint(5) unsigned NOT NULL DEFAULT '0',
  `order_count_flagged` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`snap_dt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `special_offer_uses` (
  `offer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`offer_id`,`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `special_offers` (
  `offer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL DEFAULT '',
  `campain` smallint(5) unsigned NOT NULL DEFAULT '0',
  `date_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_end` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `active` tinyint(4) NOT NULL DEFAULT '-1',
  `locked` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `store` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `message` varchar(255) NOT NULL DEFAULT '',
  `message_create_on` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `message_expires` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `message_text_color` varchar(6) NOT NULL DEFAULT '',
  `message_background_color` varchar(6) NOT NULL DEFAULT '',
  `message_link` varchar(255) NOT NULL DEFAULT '',
  `requirement_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `effect_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `effect_int1` decimal(10,0) unsigned NOT NULL DEFAULT '0',
  `effect_int2` int(10) unsigned NOT NULL DEFAULT '0',
  `effect_int3` int(10) unsigned NOT NULL DEFAULT '0',
  `effect_float1` float(10,4) unsigned NOT NULL DEFAULT '0.0000',
  `effect_float2` float(10,4) unsigned NOT NULL DEFAULT '0.0000',
  `effect_float3` float(10,4) unsigned NOT NULL DEFAULT '0.0000',
  `effect_choice1` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `effect_choice2` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `effect_choice3` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `total_displayed` int(10) unsigned NOT NULL DEFAULT '0',
  `total_messages` int(10) unsigned NOT NULL DEFAULT '0',
  `total_used` int(10) unsigned NOT NULL DEFAULT '0',
  `total_clicked` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`offer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `st_categories` (
  `cat_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `cat_master` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `name` varchar(100) NOT NULL DEFAULT '',
  `private` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `st_issue_changes` (
  `issue_id` int(10) unsigned NOT NULL DEFAULT '0',
  `change_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `cat_id` tinyint(3) unsigned DEFAULT NULL,
  `status_id` tinyint(3) unsigned DEFAULT NULL,
  `priority_id` tinyint(3) unsigned DEFAULT NULL,
  `assigned_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `message` mediumtext,
  `changed_by_email` varchar(255) NOT NULL DEFAULT '',
  `changed_by_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `ip` int(10) unsigned NOT NULL DEFAULT '0',
  `backend_only` tinyint(1) NOT NULL DEFAULT '0',
  `stamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`issue_id`,`change_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `st_issues` (
  `issue_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cat_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `status_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `priority_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `assigned_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `subject` varchar(100) NOT NULL DEFAULT '',
  `rating` tinyint(4) DEFAULT NULL,
  `created_by_email` varchar(255) NOT NULL DEFAULT '',
  `created_by_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `created_by_uid` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `created_by_store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `browser` varchar(255) NOT NULL DEFAULT '',
  `from_url` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `hash` varchar(40) NOT NULL DEFAULT '',
  `stamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`issue_id`),
  KEY `idx_create_by_cid` (`created_by_cid`),
  KEY `idx_create_by_uid` (`created_by_uid`),
  KEY `hash` (`hash`),
  KEY `status_id` (`status_id`),
  KEY `cat_id` (`cat_id`)
) ENGINE=InnoDB AUTO_INCREMENT=83463 DEFAULT CHARSET=utf8;

CREATE TABLE `st_priorities` (
  `priority_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `name` varchar(100) NOT NULL DEFAULT '',
  `color` varchar(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`priority_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `st_statuses` (
  `status_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `name` varchar(100) NOT NULL DEFAULT '',
  PRIMARY KEY (`status_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `state_codes` (
  `country` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `code` char(5) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `alternate_names` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`country`,`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `store` (
  `id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL DEFAULT '',
  `website` varchar(45) NOT NULL DEFAULT '',
  `m_website` varchar(45) NOT NULL DEFAULT '',
  `address1` varchar(45) NOT NULL DEFAULT '',
  `address2` varchar(45) NOT NULL DEFAULT '',
  `address3` varchar(45) NOT NULL DEFAULT '',
  `city` varchar(45) NOT NULL DEFAULT '',
  `state` char(2) NOT NULL DEFAULT '',
  `zipcode` varchar(10) NOT NULL DEFAULT '',
  `phone_number` varchar(45) NOT NULL DEFAULT '',
  `fax_number` varchar(45) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `phone_number_toll_free` varchar(45) NOT NULL DEFAULT '',
  `short_name` varchar(10) NOT NULL DEFAULT '',
  `name2` varchar(45) NOT NULL DEFAULT '',
  `p_description` varchar(45) NOT NULL DEFAULT '',
  `email` varchar(45) NOT NULL DEFAULT '',
  `image_small` varchar(100) NOT NULL DEFAULT '',
  `year_started` varchar(4) NOT NULL DEFAULT '',
  `extra_price` tinyint(3) unsigned NOT NULL,
  `disabled` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `store_descriptions` (
  `folder_id` int(11) NOT NULL DEFAULT '0',
  `title` varchar(80) NOT NULL DEFAULT '',
  `text` text NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `landing` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`folder_id`,`sid`,`landing`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 538624 kB';

CREATE TABLE `store_folders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `master` int(11) NOT NULL DEFAULT '0',
  `name` varchar(50) NOT NULL DEFAULT '',
  `other_names` varchar(200) NOT NULL DEFAULT '',
  `description` text NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` int(10) unsigned NOT NULL DEFAULT '0',
  `has_subtype` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `hidden` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `no_narrow` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `link` int(11) NOT NULL DEFAULT '0',
  `image` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `master` (`master`),
  KEY `name` (`name`),
  KEY `idx_type` (`type`,`id`),
  KEY `idx_id` (`id`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=26551 DEFAULT CHARSET=utf8 CHECKSUM=1;

CREATE TABLE `store_folders_landing` (
  `folder_id` int(11) NOT NULL DEFAULT '0',
  `sid` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `image` varchar(100) NOT NULL DEFAULT '',
  `description` text NOT NULL,
  `sort_by` varchar(15) NOT NULL DEFAULT '',
  `image_pos` varchar(10) NOT NULL DEFAULT 'left',
  `rotate_extras` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `random_extras` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `style_extras` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `hide_product_list` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `rows_extra` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`folder_id`,`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `store_folders_landing_extra` (
  `folder_id` int(11) NOT NULL DEFAULT '0',
  `sid` int(10) unsigned NOT NULL DEFAULT '0',
  `extra_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `image` varchar(45) NOT NULL DEFAULT '',
  `extra_folder_id` int(10) unsigned NOT NULL DEFAULT '0',
  `path` varchar(255) NOT NULL DEFAULT '',
  `name` varchar(100) NOT NULL DEFAULT '',
  `top_text` varchar(200) NOT NULL DEFAULT '',
  `order` mediumint(9) NOT NULL DEFAULT '0',
  `hidden` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`folder_id`,`sid`,`extra_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='InnoDB free: 471040 kB; InnoDB free: 454656 kB; InnoDB free:';

CREATE TABLE `supplier_index` (
  `ItemNumber` varchar(20) NOT NULL DEFAULT '',
  `SupplierID` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `SupplierItemNumber` varchar(30) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `QtyPerUnit` smallint(5) unsigned NOT NULL DEFAULT '0',
  `costeach` decimal(10,4) NOT NULL DEFAULT '0.0000',
  `unitcost` decimal(10,2) NOT NULL DEFAULT '0.00',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `min_qty_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`SupplierID`,`pid`),
  KEY `idx_itemnumber` (`ItemNumber`),
  KEY `idx_supplierid` (`SupplierID`),
  KEY `idx_pid` (`pid`),
  KEY `idx_supplieritemnumber` (`SupplierItemNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `supplier_item_data` (
  `pid` int(10) unsigned NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `supplier_itemnumber` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `supplier_cost_each` decimal(10,3) unsigned NOT NULL DEFAULT '0.000',
  `supplier_qty_per_unit` smallint(5) unsigned NOT NULL DEFAULT '0',
  `notions_itemnumber` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `notions_cost_each` decimal(10,3) unsigned NOT NULL DEFAULT '0.000',
  `notions_qty_per_unit` smallint(5) unsigned NOT NULL DEFAULT '0',
  `notions_discontinued` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `notions_case_pack` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `last_notions_info_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pid`),
  KEY `supplier_itemnumber` (`supplier_itemnumber`),
  KEY `notions_itemnumber` (`notions_itemnumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `suppliers` (
  `supplierid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `companyname` varchar(50) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `contactname` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `contacttitle` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `address` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `address2` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `city` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `region` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `postalcode` varchar(10) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `country` varchar(30) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `phone` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `fax` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `website` varchar(100) CHARACTER SET latin1 NOT NULL,
  `notes` text CHARACTER SET latin1 NOT NULL,
  `terms` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `phone2` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `email` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `accountnumber` varchar(15) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `repname` varchar(45) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `repphone` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `repfax` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `repemail` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `customernumber` varchar(45) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `company` int(10) unsigned NOT NULL DEFAULT '0',
  `sendtorep` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `hidden` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `investor_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`supplierid`)
) ENGINE=InnoDB AUTO_INCREMENT=775 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_customers_to` (
  `cid` int(10) unsigned NOT NULL,
  `sync_who` tinyint(3) unsigned NOT NULL,
  `date_synced` date NOT NULL DEFAULT '0000-00-00',
  `needs_sync` tinyint(3) unsigned NOT NULL,
  `id` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  UNIQUE KEY `sync_customers_to_cid_IDX` (`cid`,`sync_who`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_events` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sync_who` tinyint(3) unsigned NOT NULL,
  `needs_sync` tinyint(3) unsigned NOT NULL,
  `event_type` tinyint(3) unsigned NOT NULL,
  `event_for_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `event_data` text COLLATE utf8_unicode_ci NOT NULL,
  `happened_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sync_events_sync_who_IDX` (`sync_who`,`needs_sync`) USING BTREE,
  KEY `sync_events_event_for_id_IDX` (`event_for_id`) USING BTREE,
  KEY `sync_events_happened_at_IDX` (`happened_at`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=703035 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_newsletter_subscriptions_to` (
  `email_id` int(10) unsigned NOT NULL,
  `sync_who` tinyint(3) unsigned NOT NULL,
  `date_synced` date NOT NULL DEFAULT '0000-00-00',
  `needs_sync` tinyint(3) unsigned NOT NULL,
  `id` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`email_id`,`sync_who`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_orders_to` (
  `order_id` int(10) unsigned NOT NULL,
  `sync_who` tinyint(3) unsigned NOT NULL,
  UNIQUE KEY `sync_orders_to_order_id_IDX` (`order_id`,`sync_who`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_product_notify` (
  `cid` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `sync_who` tinyint(3) unsigned NOT NULL,
  `needs_sync` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`cid`,`pid`,`sync_who`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_products_to` (
  `pid` int(10) unsigned NOT NULL,
  `sync_who` tinyint(3) unsigned NOT NULL,
  `date_synced` date NOT NULL DEFAULT '0000-00-00',
  `needs_sync` tinyint(3) unsigned NOT NULL,
  `needs_sync_inv` tinyint(3) unsigned NOT NULL,
  UNIQUE KEY `sync_product_to_pid_IDX` (`pid`,`sync_who`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `sync_sms_subscriptions_to` (
  `phone_number` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `sync_who` tinyint(3) unsigned NOT NULL,
  `date_synced` date NOT NULL DEFAULT '0000-00-00',
  `needs_sync` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`phone_number`,`sync_who`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `taxjar_data` (
  `transaction_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `transaction_reference_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `transaction_date` datetime NOT NULL,
  `transaction_type` tinyint(4) NOT NULL,
  `transaction_provider` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `order_id` int(11) NOT NULL,
  `to_state` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `total_amount` decimal(10,2) NOT NULL,
  `shipping_amount` decimal(10,2) NOT NULL,
  `tax_amount` decimal(10,2) NOT NULL,
  PRIMARY KEY (`transaction_id`),
  KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `temp_email_list` (
  `email` varchar(100) NOT NULL DEFAULT '',
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `textblocks` (
  `textblock_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `store` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `before_textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `after_textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `content` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  `note` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `width` smallint(5) unsigned NOT NULL DEFAULT '0',
  `height` smallint(5) unsigned NOT NULL DEFAULT '0',
  `status` smallint(5) unsigned NOT NULL DEFAULT '0',
  `allow_comments` smallint(5) unsigned NOT NULL DEFAULT '0',
  `owner_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `stat_views` int(10) unsigned NOT NULL DEFAULT '0',
  `date_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`textblock_id`),
  KEY `title` (`title`,`store`)
) ENGINE=InnoDB AUTO_INCREMENT=10783 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `textblocks_changes` (
  `textblock_id` int(10) unsigned NOT NULL,
  `change_id` smallint(5) unsigned NOT NULL,
  `past_content` mediumtext COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`textblock_id`,`change_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `textblocks_comments` (
  `comment_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `textblock_id` int(10) unsigned NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `comment` text COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`comment_id`),
  KEY `textblock_id` (`textblock_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `textblocks_list` (
  `textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `list_id` int(10) unsigned NOT NULL DEFAULT '0',
  `content_textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `content_mobile_textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `caption` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `hide` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ordering` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`textblock_id`,`list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `textblocks_tracking` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `textblock_id` int(10) unsigned NOT NULL DEFAULT '0',
  `link_to` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `link_contents` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `timeclock` (
  `UPI` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `EmployeeID` int(11) DEFAULT NULL,
  `TimeStamp` datetime DEFAULT NULL,
  `PunchType` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`UPI`),
  KEY `TimeStamp` (`TimeStamp`)
) ENGINE=InnoDB AUTO_INCREMENT=111832 DEFAULT CHARSET=latin1;

CREATE TABLE `timeclock_admin_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `change_by_cid` int(10) unsigned NOT NULL,
  `change_datetime` datetime NOT NULL,
  `orig_punch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `orig_punch_employee_id` int(10) unsigned NOT NULL DEFAULT '0',
  `orig_punch_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `orig_punch_timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `new_punch_employee_id` int(10) unsigned NOT NULL,
  `new_punch_type` tinyint(3) unsigned NOT NULL,
  `new_punch_timestamp` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `change_by_cid` (`change_by_cid`)
) ENGINE=InnoDB AUTO_INCREMENT=3202 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `tmp_freshdesk_imported_tickets` (
  `id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `tmp_freshdesk_users` (
  `id` bigint(20) unsigned NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `tmp_klaviyo_sending` (
  `email_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `track_happened` (
  `type` tinyint(4) unsigned NOT NULL,
  `track_key` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`type`,`track_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `tracking` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `url` varchar(100) NOT NULL DEFAULT '',
  `clicks` int(10) unsigned NOT NULL DEFAULT '0',
  `conversions` int(10) unsigned NOT NULL DEFAULT '0',
  `sales` decimal(6,2) NOT NULL DEFAULT '0.00',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `description` varchar(80) NOT NULL DEFAULT '',
  `baskets` int(10) unsigned NOT NULL DEFAULT '0',
  `campaign` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=860 DEFAULT CHARSET=latin1;

CREATE TABLE `tracking_campaigns` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(45) NOT NULL DEFAULT '',
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=latin1;

CREATE TABLE `tracking_customer_product_views` (
  `cid` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `tracking_product_view` (
  `pid` int(10) NOT NULL,
  `date` date NOT NULL,
  `count` mediumint(8) unsigned NOT NULL,
  PRIMARY KEY (`date`,`pid`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `treasure_search` (
  `ts_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `text_before_click` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `text_after_click` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `image_before_click` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `image_after_click` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `image_extra` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `activated` tinyint(3) unsigned NOT NULL,
  `date_start` datetime NOT NULL,
  `date_end` datetime NOT NULL,
  `time_length_minutes` mediumint(8) unsigned NOT NULL,
  `reward_type` tinyint(3) unsigned NOT NULL,
  `reward_data` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `reward_days` smallint(5) unsigned NOT NULL,
  `reward_qty_to_find` smallint(5) unsigned NOT NULL,
  `clicks_min_to_find` smallint(5) unsigned NOT NULL,
  `clicks_chance_to_find` decimal(4,2) unsigned NOT NULL,
  PRIMARY KEY (`ts_id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `treasure_search_basket_adds` (
  `ts_id` int(10) unsigned NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  PRIMARY KEY (`ts_id`,`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `treasure_search_finds` (
  `ts_id` int(10) unsigned NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `clicked` tinyint(3) unsigned NOT NULL,
  `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ts_id`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `treasure_search_looks` (
  `ts_id` int(10) unsigned NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `pid` int(10) unsigned NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ts_id`,`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `uploaded_files` (
  `file_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `date_added` datetime NOT NULL,
  `added_by_cid` bigint(20) unsigned NOT NULL,
  `file_type` tinyint(3) unsigned NOT NULL,
  `orig_filename` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `file_extension` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `width` smallint(5) unsigned NOT NULL,
  `height` smallint(5) unsigned NOT NULL,
  PRIMARY KEY (`file_id`),
  KEY `uploaded_files_date_added_IDX` (`date_added`) USING BTREE,
  KEY `uploaded_files_added_by_cid_IDX` (`added_by_cid`) USING BTREE,
  KEY `uploaded_files_file_type_IDX` (`file_type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=903 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `ups_countrycodes` (
  `name` varchar(40) NOT NULL DEFAULT '',
  `code` char(2) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `ship_code` char(2) NOT NULL DEFAULT '',
  `noship` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`name`),
  KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ups_destination_surcharge` (
  `zipcode` varchar(20) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `country` varchar(30) NOT NULL DEFAULT '',
  `city` varchar(45) NOT NULL DEFAULT '',
  `zipcode_max` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`zipcode`,`country`,`city`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ups_fuel_surcharges` (
  `fuel_type` varchar(25) NOT NULL DEFAULT '',
  `percent` decimal(10,6) NOT NULL DEFAULT '0.000000',
  `effective_date` date NOT NULL DEFAULT '0000-00-00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`fuel_type`,`effective_date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ups_rates` (
  `weight` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `zone` int(10) unsigned NOT NULL DEFAULT '0',
  `rate` decimal(10,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`weight`,`zone`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=2401 DEFAULT CHARSET=latin1;

CREATE TABLE `ups_shipments` (
  `orderid` varchar(20) NOT NULL DEFAULT '',
  `ups_tracking` varchar(40) NOT NULL DEFAULT '',
  `ups_weight` int(10) unsigned NOT NULL DEFAULT '0',
  `ups_fee` decimal(6,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `shipped` tinyint(3) unsigned NOT NULL DEFAULT '0',
  KEY `idx_orderid` (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ups_toship` (
  `orderid` double NOT NULL AUTO_INCREMENT,
  `ShipName` varchar(45) NOT NULL DEFAULT '',
  `ShipAddress` varchar(100) NOT NULL DEFAULT '',
  `ShipAddress2` varchar(100) NOT NULL DEFAULT '',
  `ShipCity` varchar(45) NOT NULL DEFAULT '',
  `ShipState` varchar(10) NOT NULL DEFAULT '',
  `ShipZip` varchar(45) NOT NULL DEFAULT '',
  `ShipCountry` varchar(45) NOT NULL DEFAULT '',
  `ShipAttention` varchar(45) NOT NULL DEFAULT '',
  `Residential` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `Signature` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `AdultSignature` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ups_type` varchar(45) NOT NULL DEFAULT '',
  `notify_type` varchar(45) NOT NULL DEFAULT '',
  `ups_notify` varchar(45) NOT NULL DEFAULT '',
  `insured` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `OrderValue` decimal(10,2) NOT NULL DEFAULT '0.00',
  `WeightLbs` smallint(5) unsigned NOT NULL DEFAULT '0',
  `email` varchar(80) NOT NULL DEFAULT '',
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB AUTO_INCREMENT=1218086565 DEFAULT CHARSET=latin1;

CREATE TABLE `ups_zones` (
  `zip_prefix` varchar(5) NOT NULL DEFAULT '',
  `zone` int(10) unsigned DEFAULT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(10) NOT NULL DEFAULT '',
  `from_zip` varchar(10) NOT NULL DEFAULT '48603',
  PRIMARY KEY (`zip_prefix`,`type`,`from_zip`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 903168 kB';

CREATE TABLE `user_anti_csrf` (
  `uid` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `session_token` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
  `path` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `anti_csrf_token` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uid`,`session_token`,`path`,`anti_csrf_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_cherrybox_credits` (
  `cid` int(10) unsigned NOT NULL,
  `subscription_id` int(10) unsigned NOT NULL,
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `cherrybox_price_id` int(10) unsigned NOT NULL,
  `credits` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`cid`,`subscription_id`,`cherrybox_type_id`,`cherrybox_price_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_cherrybox_month_status` (
  `cid` int(10) unsigned NOT NULL,
  `subscription_id` int(10) unsigned NOT NULL,
  `send_date` date NOT NULL,
  `the_send_day` date NOT NULL,
  `cherrybox_type_id` int(11) NOT NULL,
  `cherrybox_price_id` int(11) NOT NULL,
  `using_paid_credit` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'should be named: using_existing_credit',
  `has_sent_reminder_email` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `has_card_charged` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `has_card_declined` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `has_credit_used` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `has_pause_used` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `has_been_processed` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_paused` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `created_order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `charge_order_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`subscription_id`,`send_date`),
  KEY `created_order_id` (`created_order_id`),
  KEY `charge_order_id` (`charge_order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_cherrybox_subscription_status` (
  `cid` int(10) unsigned NOT NULL,
  `subscription_id` int(10) unsigned NOT NULL,
  `cherrybox_type_id` int(10) unsigned NOT NULL,
  `cherrybox_price_id` int(10) unsigned NOT NULL,
  `address_id` int(10) unsigned NOT NULL,
  `is_gift` tinyint(3) unsigned NOT NULL,
  `month_credits_avail` tinyint(3) unsigned NOT NULL,
  `months_paused` tinyint(3) unsigned NOT NULL,
  `auto_renew_cherrybox_price_id` int(10) unsigned NOT NULL,
  `auto_renew_card_id` int(10) unsigned NOT NULL,
  `auto_renew_ship_method` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `hidden` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`subscription_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_images` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `filename` varchar(45) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `image_type` char(3) NOT NULL DEFAULT '',
  `gallery_id` int(10) unsigned NOT NULL DEFAULT '0',
  `caption` varchar(80) NOT NULL DEFAULT '',
  `image_width` int(10) unsigned NOT NULL DEFAULT '0',
  `article_id` int(10) unsigned NOT NULL DEFAULT '0',
  `missing` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_gallery_id` (`gallery_id`)
) ENGINE=InnoDB AUTO_INCREMENT=562911 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 1376256 kB';

CREATE TABLE `user_interested_in` (
  `cid` int(11) NOT NULL,
  `cat_id` int(11) NOT NULL,
  PRIMARY KEY (`cid`,`cat_id`),
  KEY `cat_id` (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_last_order` (
  `uid` char(20) NOT NULL DEFAULT '',
  `order_id` int(10) unsigned NOT NULL DEFAULT '0',
  `sid` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `user_merge_todo` (
  `id` int(10) unsigned NOT NULL,
  `cid` int(10) unsigned NOT NULL,
  `merge_froms` text COLLATE utf8_unicode_ci NOT NULL,
  `auth_code` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_messages` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `other_cid` int(1) NOT NULL DEFAULT '0',
  `type` tinyint(10) NOT NULL DEFAULT '0',
  `priority` tinyint(10) NOT NULL DEFAULT '0',
  `unread` tinyint(1) NOT NULL DEFAULT '0',
  `subject` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `message` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_lookup` (`cid`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_notifications` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `new` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `from_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `id1` int(10) unsigned NOT NULL DEFAULT '0',
  `id2` int(10) unsigned NOT NULL DEFAULT '0',
  `data` text COLLATE utf8_unicode_ci,
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_main` (`cid`,`new`)
) ENGINE=InnoDB AUTO_INCREMENT=1681924 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_notifications_phpbb3_ignore` (
  `cid` int(10) unsigned NOT NULL,
  `topic_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`cid`,`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_notifications_phpbb3_topics` (
  `cid` int(10) unsigned NOT NULL,
  `topic_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`cid`,`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_notify_reminder_last` (
  `cid` int(10) unsigned NOT NULL,
  `notify_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `notify_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`cid`,`notify_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_notify_settings` (
  `cid` int(10) NOT NULL DEFAULT '0',
  `type` int(10) NOT NULL DEFAULT '0',
  `send_email` tinyint(4) DEFAULT NULL,
  `send_notify` tinyint(4) DEFAULT NULL,
  `send_txt` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`cid`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_onetime_login` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `hashed_token` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
  `uid_for` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `redirect_after` text COLLATE utf8_unicode_ci NOT NULL,
  `created_by` int(10) unsigned NOT NULL,
  `created_ip` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `created_date` datetime NOT NULL,
  `expires` datetime NOT NULL,
  `used` tinyint(3) unsigned NOT NULL,
  `short_code` mediumint(8) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_onetime_login_short_code_IDX` (`short_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=77317 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_points` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL,
  `point_change` int(11) NOT NULL,
  `reason` smallint(5) unsigned NOT NULL,
  `happened_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_points_cid_IDX` (`cid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2317108 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_points_daily_log` (
  `cid` int(10) unsigned NOT NULL,
  `date_saved` datetime NOT NULL,
  `points` int(11) NOT NULL,
  PRIMARY KEY (`cid`,`date_saved`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_saved_cc` (
  `cid` int(11) unsigned NOT NULL,
  `card_id` int(11) unsigned NOT NULL,
  `deleted` tinyint(3) unsigned NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `transarmor_token` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `cardholder_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `card_type` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `expire_month` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `expire_year` varchar(4) COLLATE utf8_unicode_ci NOT NULL,
  `street1` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `street2` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `city` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `state` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `zip` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `country` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `avs` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `gateway` enum('verisign','paradata','firstdata','firstdata_gge4','firstdata_gge4_indep','payhub') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'firstdata_gge4',
  PRIMARY KEY (`cid`,`card_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_session_ip_access` (
  `ip_address` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `access` tinyint(3) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_sessions` (
  `uid` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `uid_from` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `token` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `login_token` varchar(22) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `type` tinyint(4) NOT NULL DEFAULT '0',
  `domain` varchar(50) NOT NULL DEFAULT '',
  `ip` varchar(45) NOT NULL DEFAULT '',
  `user_agent` varchar(255) NOT NULL DEFAULT '',
  `time` bigint(20) unsigned NOT NULL DEFAULT '0',
  `expires` bigint(20) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uid`,`token`),
  KEY `idx_lookup` (`token`,`type`,`domain`),
  KEY `domain` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `user_shipping_pref` (
  `cid` int(10) unsigned NOT NULL,
  `pref` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`cid`,`pref`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `user_visits` (
  `cid` int(10) unsigned NOT NULL,
  `store` tinyint(3) unsigned NOT NULL,
  `date_visit` date NOT NULL,
  PRIMARY KEY (`cid`,`store`,`date_visit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `users` (
  `cid` double unsigned NOT NULL AUTO_INCREMENT,
  `uid` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `ip` varchar(15) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `browser` varchar(60) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `email` varchar(80) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `phone` varchar(20) NOT NULL DEFAULT '',
  `firstname` varchar(20) CHARACTER SET latin1 DEFAULT '',
  `lastname` varchar(20) CHARACTER SET latin1 DEFAULT '',
  `company` varchar(50) CHARACTER SET latin1 DEFAULT '',
  `password` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `password_changed_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `newsletter` tinyint(4) DEFAULT '0',
  `forcepassword` tinyint(4) DEFAULT '0',
  `count` int(10) unsigned DEFAULT '0',
  `itemcount` int(10) unsigned DEFAULT '0',
  `basketsubtotal` double(6,2) DEFAULT '0.00',
  `totalcount` int(10) unsigned DEFAULT '0',
  `points` int(10) unsigned DEFAULT '0',
  `referer` varchar(40) CHARACTER SET latin1 DEFAULT '',
  `b_address` int(3) unsigned DEFAULT '0',
  `s_address` int(3) unsigned DEFAULT '0',
  `screenname` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `board_layouts` int(11) NOT NULL DEFAULT '0',
  `board_avatar` text CHARACTER SET latin1 NOT NULL,
  `board_bio` blob NOT NULL,
  `last_visit` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `eggs` smallint(5) unsigned NOT NULL DEFAULT '0',
  `basket_default` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `last_signin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `promo` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `rows_per_page` int(10) unsigned NOT NULL DEFAULT '0',
  `product_order` varchar(15) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `customer_credit` decimal(7,2) NOT NULL DEFAULT '0.00',
  `payment_method` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `basket_show_os` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `style` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `board_images` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `board_signatures` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `wishlist_private` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `wishlist_use_remove` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `board_hideme` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `board_dt_leader` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `profile_image_id` int(10) unsigned NOT NULL DEFAULT '0',
  `gallery_default` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `gallery_thumbnails` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `st_view` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `st_sort` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `st_zoom` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `st_page` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `st_thumb` tinyint(3) unsigned DEFAULT '0',
  `investor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `designer_active` tinyint(1) NOT NULL DEFAULT '0',
  `board_gct` date NOT NULL DEFAULT '0000-00-00',
  `phpbb3_id` int(10) unsigned NOT NULL DEFAULT '0',
  `orders_shipped` smallint(5) unsigned NOT NULL DEFAULT '0',
  `tax_exempt` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`uid`),
  KEY `cid` (`cid`),
  KEY `email` (`email`),
  KEY `idx_screenname` (`screenname`),
  KEY `idx_ip` (`ip`),
  KEY `idx_phpbbid` (`phpbb3_id`),
  KEY `idx_investor` (`investor_id`),
  KEY `firstname` (`firstname`),
  KEY `lastname` (`lastname`),
  KEY `company` (`company`)
) ENGINE=InnoDB AUTO_INCREMENT=38000599 DEFAULT CHARSET=utf8 PACK_KEYS=1 COMMENT='InnoDB free: 94208 kB';

CREATE TABLE `users_bio` (
  `cid` int(11) NOT NULL DEFAULT '0',
  `display_name` varchar(50) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `avatar` varchar(255) NOT NULL DEFAULT '',
  `avatar_width` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `avatar_height` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `avatar_file_id` bigint(20) unsigned NOT NULL,
  `picture` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `picture_width` smallint(5) unsigned NOT NULL DEFAULT '0',
  `picture_height` smallint(5) unsigned NOT NULL DEFAULT '0',
  `picture_file_id` bigint(20) unsigned NOT NULL,
  `location` varchar(45) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `date_birthday` date NOT NULL DEFAULT '0000-00-00',
  `show_full_birthday` tinyint(1) NOT NULL DEFAULT '0',
  `about_me` text CHARACTER SET latin1 NOT NULL,
  PRIMARY KEY (`cid`),
  KEY `users_bio_avatar_file_id_IDX` (`avatar_file_id`) USING BTREE,
  KEY `users_bio_picture_file_id_IDX` (`picture_file_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='InnoDB free: 520192 kB';

CREATE TABLE `users_block_by_address` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `street1` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `city` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `state` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `zip` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `country` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `note` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `date_added` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `added_by_cid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `users_block_by_email` (
  `email` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `note` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `added_by_cid` int(11) NOT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `users_lastvisit` (
  `last_visit` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `uid` varchar(23) NOT NULL DEFAULT '',
  `ip` varchar(15) NOT NULL DEFAULT '',
  PRIMARY KEY (`uid`),
  KEY `idx_last_visit` (`last_visit`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1;

CREATE TABLE `users_points_bonus` (
  `bonus_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `points` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`bonus_id`,`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `users_recommendations` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `score` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `users_recommendations_exclusions` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `pid` int(10) unsigned NOT NULL DEFAULT '0',
  `manual` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `users_social_link` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `social_type` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `id` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `screenname` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `token` text COLLATE utf8_unicode_ci NOT NULL,
  `token_secret` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`cid`,`social_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `users_temp_data` (
  `uid` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `value` text COLLATE utf8_unicode_ci,
  `expires` datetime DEFAULT NULL,
  PRIMARY KEY (`uid`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `usps_all_rates` (
  `version` varchar(15) NOT NULL,
  `method` varchar(10) NOT NULL,
  `zone` varchar(10) NOT NULL,
  `weight_oz_upto` smallint(5) unsigned NOT NULL,
  `rate` decimal(10,2) unsigned NOT NULL,
  PRIMARY KEY (`version`,`method`,`zone`,`weight_oz_upto`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `usps_all_zone_times` (
  `version` varchar(6) COLLATE utf8_unicode_ci NOT NULL,
  `origin_zip` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `dest_zip` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `method` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `days` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`version`,`origin_zip`,`dest_zip`,`method`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `usps_insurance` (
  `max_pkg_value` int(10) unsigned NOT NULL DEFAULT '0',
  `pkg_type` varchar(45) NOT NULL DEFAULT '',
  `rate` decimal(6,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`max_pkg_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `usps_intl_rates` (
  `weight` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `zone` int(10) unsigned NOT NULL DEFAULT '0',
  `type` varchar(10) NOT NULL DEFAULT '',
  `rate` decimal(6,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`weight`,`zone`,`type`),
  KEY `zonetype` (`zone`,`type`,`rate`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1121 DEFAULT CHARSET=latin1;

CREATE TABLE `usps_intl_zones` (
  `country` varchar(10) NOT NULL DEFAULT '',
  `zone` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type` varchar(10) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`country`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `usps_location_zones` (
  `version` varchar(10) NOT NULL,
  `location` varchar(10) NOT NULL,
  `method` varchar(10) NOT NULL,
  `zone` varchar(10) NOT NULL,
  `max_weight_oz` smallint(10) unsigned NOT NULL,
  PRIMARY KEY (`version`,`location`,`method`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `usps_rates` (
  `weight` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `zone` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `rate` decimal(10,2) NOT NULL DEFAULT '0.00',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`weight`,`zone`)
) ENGINE=InnoDB AUTO_INCREMENT=1121 DEFAULT CHARSET=latin1;

CREATE TABLE `usps_service_times` (
  `origin_zip` char(3) COLLATE utf8_unicode_ci NOT NULL,
  `dest_zip` char(3) COLLATE utf8_unicode_ci NOT NULL,
  `firstclass_days` tinyint(3) unsigned NOT NULL,
  `priority_days` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`origin_zip`,`dest_zip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `usps_zones` (
  `zip_prefix` char(3) NOT NULL DEFAULT '',
  `zone` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`zip_prefix`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_addressbook` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `address_cid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`address_cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_forums` (
  `forum_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  `cat_id` int(10) unsigned NOT NULL DEFAULT '0',
  `forum_name` varchar(150) DEFAULT NULL,
  `forum_desc` text,
  `forum_status` tinyint(4) NOT NULL DEFAULT '0',
  `forum_order` mediumint(8) unsigned NOT NULL DEFAULT '1',
  `forum_posts` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `forum_topics` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `forum_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `prune_next` int(11) DEFAULT NULL,
  `prune_enable` tinyint(1) NOT NULL DEFAULT '0',
  `auth_view` tinyint(2) NOT NULL DEFAULT '0',
  `auth_read` tinyint(2) NOT NULL DEFAULT '0',
  `auth_post` tinyint(2) NOT NULL DEFAULT '0',
  `auth_reply` tinyint(2) NOT NULL DEFAULT '0',
  `auth_edit` tinyint(2) NOT NULL DEFAULT '0',
  `auth_delete` tinyint(2) NOT NULL DEFAULT '0',
  `auth_sticky` tinyint(2) NOT NULL DEFAULT '0',
  `auth_announce` tinyint(2) NOT NULL DEFAULT '0',
  `auth_vote` tinyint(2) NOT NULL DEFAULT '0',
  `auth_pollcreate` tinyint(2) NOT NULL DEFAULT '0',
  `auth_attachments` tinyint(2) NOT NULL DEFAULT '0',
  `forum_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `forum_dt` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `forum_days` int(10) unsigned NOT NULL DEFAULT '0',
  `forum_private` int(1) unsigned NOT NULL DEFAULT '0',
  `forum_designer` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`forum_id`,`cat_id`),
  KEY `forums_order` (`forum_order`),
  KEY `cat_id` (`cat_id`),
  KEY `forum_last_post_id` (`forum_last_post_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1;

CREATE TABLE `valley_forums_allow` (
  `forum_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `allow` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `cat_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`forum_id`,`cid`),
  KEY `idx_allow` (`allow`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_gallery_categories` (
  `category_title` varchar(45) NOT NULL DEFAULT '',
  `category_type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `forum_id` int(10) unsigned NOT NULL DEFAULT '0',
  `category_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `layout_count` int(10) unsigned NOT NULL DEFAULT '0',
  `category_voting` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `category_flag` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `startdate` date NOT NULL DEFAULT '0000-00-00',
  `enddate` date NOT NULL DEFAULT '0000-00-00',
  `description` mediumtext NOT NULL,
  `new_layouts` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `official` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `rules` mediumtext NOT NULL,
  `allow_type` int(10) unsigned NOT NULL DEFAULT '0',
  `allow_multiple` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `suggested_by` int(10) unsigned NOT NULL DEFAULT '0',
  `suggeted_galleryid` int(10) unsigned NOT NULL DEFAULT '0',
  `suggested_votes` smallint(5) unsigned NOT NULL DEFAULT '0',
  `scrapbook_count` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`category_id`),
  KEY `gallery_group` (`category_id`,`category_title`),
  KEY `summary` (`forum_id`,`category_type`,`startdate`,`enddate`,`active`),
  KEY `idx_title` (`category_title`,`category_type`,`forum_id`,`startdate`) USING BTREE,
  KEY `Index 5` (`category_type`,`active`)
) ENGINE=InnoDB AUTO_INCREMENT=15539 DEFAULT CHARSET=utf8;

CREATE TABLE `valley_gallery_index` (
  `gallery_image_id` int(10) unsigned NOT NULL DEFAULT '0',
  `category_id` int(30) NOT NULL DEFAULT '0',
  `index_type` int(11) NOT NULL DEFAULT '0',
  `next_layout` int(10) unsigned DEFAULT '0',
  `prev_layout` int(10) unsigned DEFAULT '0',
  `gallery_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`gallery_image_id`,`category_id`,`index_type`,`gallery_id`),
  KEY `categoryid` (`category_id`),
  KEY `type` (`index_type`),
  KEY `galleryid` (`gallery_id`),
  KEY `gallery_image` (`gallery_image_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_ignore` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `ignore_cid` int(11) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`ignore_cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_mymessages` (
  `message_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `message_to_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `post_id` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `message_subject` varchar(80) NOT NULL DEFAULT '',
  `message_from_cid` int(10) unsigned NOT NULL DEFAULT '0',
  `message_received` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `message_email_alert` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `message_to_sn` varchar(20) NOT NULL DEFAULT '',
  `message_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `message_reply` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `message_folder` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `message_owner_cid` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`message_id`),
  KEY `idx_msg_to_cid` (`message_to_cid`),
  KEY `idx_message_from_cid` (`message_from_cid`),
  KEY `idx_msg_owner` (`message_owner_cid`),
  KEY `idx_new_msg` (`message_owner_cid`,`message_received`),
  KEY `idx_message_sent` (`message_sent`)
) ENGINE=InnoDB AUTO_INCREMENT=1379171 DEFAULT CHARSET=latin1;

CREATE TABLE `valley_mymessages_folders` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `folder` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`cid`,`folder`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_poll_options` (
  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
  `id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `description` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`topic_id`,`id`),
  KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_poll_votes` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
  `vote` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`topic_id`),
  KEY `idx_topicid` (`topic_id`),
  KEY `idx_vote` (`vote`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_posts` (
  `post_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
  `forum_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `poster_id` int(10) unsigned NOT NULL DEFAULT '0',
  `post_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `poster_ip` varchar(15) NOT NULL DEFAULT '',
  `post_screenname` varchar(25) DEFAULT NULL,
  `enable_sig` tinyint(1) NOT NULL DEFAULT '1',
  `post_edit_time` datetime DEFAULT NULL,
  `post_edit_count` smallint(5) unsigned NOT NULL DEFAULT '0',
  `post_text` blob NOT NULL,
  `message_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `post_private` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`post_id`),
  KEY `forum_id` (`forum_id`),
  KEY `topic_id` (`topic_id`),
  KEY `poster_id` (`poster_id`),
  KEY `post_time` (`post_time`),
  KEY `message_id` (`message_id`),
  KEY `poster_ip` (`poster_ip`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_saved_topics` (
  `cid` int(11) NOT NULL DEFAULT '0',
  `topic_id` int(11) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cid`,`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_screenname_history` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `old_screenname` varchar(30) NOT NULL DEFAULT '',
  `new_screenname` varchar(30) NOT NULL DEFAULT '',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13646 DEFAULT CHARSET=latin1;

CREATE TABLE `valley_topics` (
  `topic_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `forum_id` smallint(8) unsigned NOT NULL DEFAULT '0',
  `topic_title` varchar(60) NOT NULL DEFAULT '',
  `topic_poster` int(10) unsigned NOT NULL DEFAULT '0',
  `topic_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `topic_views` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `topic_replies` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `topic_status` tinyint(3) NOT NULL DEFAULT '0',
  `topic_type` int(10) unsigned NOT NULL DEFAULT '0',
  `topic_first_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `topic_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `topic_moved_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `topic_email_alert` tinyint(4) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `topic_last_reply_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `topic_images` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `topic_categories` blob NOT NULL,
  `topic_freeze` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `topic_anchor` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `topic_hide` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `topic_private` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `topic_poll` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`topic_id`),
  KEY `forum_id` (`forum_id`),
  KEY `topic_moved_id` (`topic_moved_id`),
  KEY `topic_status` (`topic_status`),
  KEY `topic_type` (`topic_type`),
  KEY `topic_poster` (`topic_poster`),
  KEY `idx_reply_date` (`topic_last_reply_date`)
) ENGINE=InnoDB AUTO_INCREMENT=209108 DEFAULT CHARSET=latin1;

CREATE TABLE `valley_votes` (
  `category_id` int(10) unsigned NOT NULL DEFAULT '0',
  `forum_id` int(10) unsigned NOT NULL DEFAULT '0',
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `category_type` int(10) unsigned NOT NULL DEFAULT '0',
  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`category_id`,`forum_id`,`cid`,`category_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `valley_warn` (
  `cid` int(10) unsigned NOT NULL DEFAULT '0',
  `warn_cid` int(11) NOT NULL DEFAULT '0',
  `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `strength` decimal(2,1) unsigned NOT NULL DEFAULT '0.0',
  PRIMARY KEY (`cid`,`warn_cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `vb_settings` (
  `id` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `value` text COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `vb_stationsettings` (
  `computername` varchar(14) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ShippingLabelPrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ReceiptPrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PackingSlipPrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `UPSPrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PostagePrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `BarCodePrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `GCPrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Shipping_LabelPrinter` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PickingTicketPrinter` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `ReceiptPrinter_rush` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`computername`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `zip_codes` (
  `zipcode` varchar(5) NOT NULL DEFAULT '',
  `city` varchar(35) NOT NULL DEFAULT '',
  `state` char(2) NOT NULL DEFAULT '',
  `county` varchar(45) NOT NULL DEFAULT '',
  `areacode` varchar(55) NOT NULL DEFAULT '',
  `citytype` char(1) NOT NULL DEFAULT '',
  `cityaliasabbreviation` varchar(13) NOT NULL DEFAULT '',
  `cityaliasname` varchar(35) NOT NULL DEFAULT '',
  `latitude` double DEFAULT NULL,
  `longitude` double DEFAULT NULL,
  `timezone` char(2) NOT NULL DEFAULT '',
  `elevation` decimal(7,6) NOT NULL DEFAULT '0.000000',
  `countyfips` char(3) NOT NULL DEFAULT '',
  `daylightsaving` char(1) NOT NULL DEFAULT '',
  KEY `Index_1` (`zipcode`,`city`,`state`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;



/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;