Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save conschneider/97891d599599d1953c33cb8b68805c1a to your computer and use it in GitHub Desktop.
Save conschneider/97891d599599d1953c33cb8b68805c1a to your computer and use it in GitHub Desktop.
Please note the wp_ prefix and change accordingly if needed! Also check the table names so you don't drop data of tables already there!
/*
* Please note the wp_ prefix and change accordingly if needed!
* Also check the table names so you don't drop data of tables already there!
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for wp_wc_customer_lookup
-- ----------------------------
DROP TABLE IF EXISTS `wp_wc_customer_lookup`;
CREATE TABLE `wp_wc_customer_lookup` (
`customer_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned DEFAULT NULL,
`username` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`first_name` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`last_name` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`email` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`date_last_active` timestamp NULL DEFAULT NULL,
`date_registered` timestamp NULL DEFAULT NULL,
`country` char(2) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`postcode` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`city` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`state` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
PRIMARY KEY (`customer_id`),
UNIQUE KEY `user_id` (`user_id`),
KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- ----------------------------
-- Table structure for wp_wc_order_coupon_lookup
-- ----------------------------
DROP TABLE IF EXISTS `wp_wc_order_coupon_lookup`;
CREATE TABLE `wp_wc_order_coupon_lookup` (
`order_id` bigint(20) unsigned NOT NULL,
`coupon_id` bigint(20) unsigned NOT NULL,
`date_created` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
`discount_amount` double NOT NULL DEFAULT '0',
PRIMARY KEY (`order_id`,`coupon_id`),
KEY `coupon_id` (`coupon_id`),
KEY `date_created` (`date_created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- ----------------------------
-- Table structure for wp_wc_order_product_lookup
-- ----------------------------
DROP TABLE IF EXISTS `wp_wc_order_product_lookup`;
CREATE TABLE `wp_wc_order_product_lookup` (
`order_item_id` bigint(20) unsigned NOT NULL,
`order_id` bigint(20) unsigned NOT NULL,
`product_id` bigint(20) unsigned NOT NULL,
`variation_id` bigint(20) unsigned NOT NULL,
`customer_id` bigint(20) unsigned DEFAULT NULL,
`date_created` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
`product_qty` int(11) NOT NULL,
`product_net_revenue` double NOT NULL DEFAULT '0',
`product_gross_revenue` double NOT NULL DEFAULT '0',
`coupon_amount` double NOT NULL DEFAULT '0',
`tax_amount` double NOT NULL DEFAULT '0',
`shipping_amount` double NOT NULL DEFAULT '0',
`shipping_tax_amount` double NOT NULL DEFAULT '0',
PRIMARY KEY (`order_item_id`),
KEY `order_id` (`order_id`),
KEY `product_id` (`product_id`),
KEY `customer_id` (`customer_id`),
KEY `date_created` (`date_created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- ----------------------------
-- Table structure for wp_wc_order_stats
-- ----------------------------
DROP TABLE IF EXISTS `wp_wc_order_stats`;
CREATE TABLE `wp_wc_order_stats` (
`order_id` bigint(20) unsigned NOT NULL,
`parent_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`date_created` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
`date_created_gmt` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
`num_items_sold` int(11) NOT NULL DEFAULT '0',
`total_sales` double NOT NULL DEFAULT '0',
`tax_total` double NOT NULL DEFAULT '0',
`shipping_total` double NOT NULL DEFAULT '0',
`net_total` double NOT NULL DEFAULT '0',
`returning_customer` tinyint(1) DEFAULT NULL,
`status` varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`customer_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`order_id`),
KEY `date_created` (`date_created`),
KEY `customer_id` (`customer_id`),
KEY `status` (`status`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- ----------------------------
-- Table structure for wp_wc_order_tax_lookup
-- ----------------------------
DROP TABLE IF EXISTS `wp_wc_order_tax_lookup`;
CREATE TABLE `wp_wc_order_tax_lookup` (
`order_id` bigint(20) unsigned NOT NULL,
`tax_rate_id` bigint(20) unsigned NOT NULL,
`date_created` datetime NOT NULL DEFAULT '0000-01-01 00:00:00',
`shipping_tax` double NOT NULL DEFAULT '0',
`order_tax` double NOT NULL DEFAULT '0',
`total_tax` double NOT NULL DEFAULT '0',
PRIMARY KEY (`order_id`,`tax_rate_id`),
KEY `tax_rate_id` (`tax_rate_id`),
KEY `date_created` (`date_created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
SET FOREIGN_KEY_CHECKS = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment