Add DB schema (45 tables) and vhost config

This commit is contained in:
2026-05-25 13:51:25 +00:00
parent 996ca0d621
commit d30851e3ec
5 changed files with 1181 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
docRoot $VH_ROOT/public_html
vhDomain $VH_NAME
vhAliases www.$VH_NAME
adminEmails admin@tomsjavajive.com
enableGzip 1
enableIpGeo 1
index {
useServer 0
indexFiles index.php, index.html
}
errorlog $VH_ROOT/logs/$VH_NAME.error_log {
useServer 0
logLevel WARN
rollingSize 10M
}
accesslog $VH_ROOT/logs/$VH_NAME.access_log {
useServer 0
logFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
logHeaders 5
rollingSize 10M
keepDays 10
compressArchive 1
}
scripthandler {
add lsapi:tomsj4710 php
}
extprocessor tomsj4710 {
type lsapi
address UDS://tmp/lshttpd/tomsj4710.sock
maxConns 10
env LSAPI_CHILDREN=10
initTimeout 600
retryTimeout 0
persistConn 1
pcKeepAliveTimeout 1
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp85/bin/lsphp
extUser tomsj4710
extGroup tomsj4710
memSoftLimit 1024M
memHardLimit 1024M
procSoftLimit 400
procHardLimit 500
}
phpIniOverride {
}
module cache {
storagePath /usr/local/lsws/cachedata/$VH_NAME
}
rewrite {
enable 1
autoLoadHtaccess 1
}
context /.well-known/acme-challenge {
location /usr/local/lsws/Example/html/.well-known/acme-challenge
allowBrowse 1
rewrite {
enable 0
}
addDefaultCharset off
phpIniOverride {
}
}
vhssl {
keyFile /etc/letsencrypt/live/tomsjavajive.com/privkey.pem
certFile /etc/letsencrypt/live/tomsjavajive.com/fullchain.pem
certChain 1
sslProtocol 24
enableECDHE 1
renegProtection 1
sslSessionCache 1
enableSpdy 15
enableStapling 1
ocspRespMaxAge 86400
}
+85
View File
@@ -0,0 +1,85 @@
docroot $VH_ROOT/public_html
vhaliases www.$VH_NAME
enablegzip 1
phpinioverride
vhdomain $VH_NAME
enableipgeo 1
adminemails admin@tomsjavajive.com
extprocessor tomsj4710 {
inittimeout 600
retrytimeout 0
persistconn 1
maxconns 10
type lsapi
address UDS://tmp/lshttpd/tomsj4710.sock
extuser tomsj4710
extgroup tomsj4710
prochardlimit 500
pckeepalivetimeout 1
respbuffer 0
autostart 1
path /usr/local/lsws/lsphp85/bin/lsphp
env LSAPI_CHILDREN=10
procsoftlimit 400
memsoftlimit 1024M
memhardlimit 1024M
}
vhssl {
keyfile /etc/letsencrypt/live/tomsjavajive.com/privkey.pem
certfile /etc/letsencrypt/live/tomsjavajive.com/fullchain.pem
certchain 1
enablespdy 15
enablestapling 1
ocsprespmaxage 86400
sslprotocol 24
enableecdhe 1
renegprotection 1
sslsessioncache 1
}
scripthandler {
add lsapi:tomsj4710 php
}
module cache {
param storagepath /usr/local/lsws/cachedata/$VH_NAME
unknownkeywords storagepath /usr/local/lsws/cachedata/$VH_NAME
}
accesslog $VH_ROOT/logs/$VH_NAME.access_log {
keepdays 10
useserver 0
logformat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
compressarchive 1
logheaders 5
rollingsize 10M
}
index {
indexfiles index.php, index.html
useserver 0
}
context /.well-known/acme-challenge {
phpinioverride
adddefaultcharset off
allowbrowse 1
location /usr/local/lsws/Example/html/.well-known/acme-challenge
rewrite {
enable 0
}
}
rewrite {
enable 1
autoloadhtaccess 1
}
errorlog $VH_ROOT/logs/$VH_NAME.error_log {
rollingsize 10M
useserver 0
loglevel WARN
}
+91
View File
@@ -0,0 +1,91 @@
docRoot $VH_ROOT/public_html
vhDomain $VH_NAME
vhAliases www.$VH_NAME
adminEmails admin@tomsjavajive.com
enableGzip 1
enableIpGeo 1
index {
useServer 0
indexFiles index.php, index.html
}
errorlog $VH_ROOT/logs/$VH_NAME.error_log {
useServer 0
logLevel WARN
rollingSize 10M
}
accesslog $VH_ROOT/logs/$VH_NAME.access_log {
useServer 0
logFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
logHeaders 5
rollingSize 10M
keepDays 10
compressArchive 1
}
scripthandler {
add lsapi:tomsj4710 php
}
extprocessor tomsj4710 {
type lsapi
address UDS://tmp/lshttpd/tomsj4710.sock
maxConns 10
env LSAPI_CHILDREN=10
initTimeout 600
retryTimeout 0
persistConn 1
pcKeepAliveTimeout 1
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp85/bin/lsphp
extUser tomsj4710
extGroup tomsj4710
memSoftLimit 1024M
memHardLimit 1024M
procSoftLimit 400
procHardLimit 500
}
phpIniOverride {
}
module cache {
storagePath /usr/local/lsws/cachedata/$VH_NAME
}
rewrite {
enable 1
autoLoadHtaccess 1
}
context /.well-known/acme-challenge {
location /usr/local/lsws/Example/html/.well-known/acme-challenge
allowBrowse 1
rewrite {
enable 0
}
addDefaultCharset off
phpIniOverride {
}
}
vhssl {
keyFile /etc/letsencrypt/live/tomsjavajive.com/privkey.pem
certFile /etc/letsencrypt/live/tomsjavajive.com/fullchain.pem
certChain 1
sslProtocol 24
enableECDHE 1
renegProtection 1
sslSessionCache 1
enableSpdy 15
enableStapling 1
ocspRespMaxAge 86400
}
+130
View File
@@ -0,0 +1,130 @@
head 1.2;
access;
symbols;
locks
root:1.2; strict;
comment @# @;
1.2
date 2026.05.15.20.13.36; author root; state Exp;
branches;
next 1.1;
1.1
date 2026.05.15.20.12.31; author root; state Exp;
branches;
next ;
desc
@/usr/local/lsws/conf/vhosts/tomsjavajive.com/vhost.conf0
@
1.2
log
@Update
@
text
@docRoot $VH_ROOT/public_html
vhDomain $VH_NAME
vhAliases www.$VH_NAME
adminEmails admin@@tomsjavajive.com
enableGzip 1
enableIpGeo 1
index {
useServer 0
indexFiles index.php, index.html
}
errorlog $VH_ROOT/logs/$VH_NAME.error_log {
useServer 0
logLevel WARN
rollingSize 10M
}
accesslog $VH_ROOT/logs/$VH_NAME.access_log {
useServer 0
logFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
logHeaders 5
rollingSize 10M
keepDays 10
compressArchive 1
}
scripthandler {
add lsapi:tomsj4710 php
}
extprocessor tomsj4710 {
type lsapi
address UDS://tmp/lshttpd/tomsj4710.sock
maxConns 10
env LSAPI_CHILDREN=10
initTimeout 600
retryTimeout 0
persistConn 1
pcKeepAliveTimeout 1
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp85/bin/lsphp
extUser tomsj4710
extGroup tomsj4710
memSoftLimit 1024M
memHardLimit 1024M
procSoftLimit 400
procHardLimit 500
}
phpIniOverride {
}
module cache {
storagePath /usr/local/lsws/cachedata/$VH_NAME
}
rewrite {
enable 1
autoLoadHtaccess 1
}
context /.well-known/acme-challenge {
location /usr/local/lsws/Example/html/.well-known/acme-challenge
allowBrowse 1
rewrite {
enable 0
}
addDefaultCharset off
phpIniOverride {
}
}
vhssl {
keyFile /etc/letsencrypt/live/tomsjavajive.com/privkey.pem
certFile /etc/letsencrypt/live/tomsjavajive.com/fullchain.pem
certChain 1
sslProtocol 24
enableECDHE 1
renegProtection 1
sslSessionCache 1
enableSpdy 15
enableStapling 1
ocspRespMaxAge 86400
}
@
1.1
log
@Update
@
text
@d79 13
@
+784
View File
@@ -0,0 +1,784 @@
/*M!999999\- enable the sandbox mode */
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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 */;
DROP TABLE IF EXISTS `abandoned_carts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `abandoned_carts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cart_id` varchar(50) NOT NULL,
`customer_id` varchar(50) DEFAULT NULL,
`customer_email` varchar(255) DEFAULT NULL,
`items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`items`)),
`subtotal` decimal(10,2) NOT NULL,
`recovery_email_sent` tinyint(1) DEFAULT 0,
`recovered` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `cart_id` (`cart_id`),
KEY `idx_customer_email` (`customer_email`),
KEY `idx_recovered` (`recovered`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `about_us_sections`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `about_us_sections` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`section_id` varchar(50) NOT NULL,
`heading` varchar(255) DEFAULT NULL,
`body` longtext NOT NULL,
`sort_order` int(11) DEFAULT 0,
`is_active` tinyint(1) DEFAULT 1,
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `section_id` (`section_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `admin_users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `admin_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(50) NOT NULL,
`email` varchar(255) NOT NULL,
`password_hash` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`picture` varchar(500) DEFAULT NULL,
`is_admin` tinyint(1) DEFAULT 1,
`is_master` tinyint(1) DEFAULT 0,
`permissions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`permissions`)),
`created_at` timestamp NULL DEFAULT current_timestamp(),
`last_login` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`),
UNIQUE KEY `email` (`email`),
KEY `idx_email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
`image` varchar(500) DEFAULT NULL,
`parent_id` varchar(50) DEFAULT NULL,
`sort_order` int(11) DEFAULT 0,
`is_active` tinyint(1) DEFAULT 1,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `category_id` (`category_id`),
UNIQUE KEY `slug` (`slug`),
KEY `idx_slug` (`slug`),
KEY `idx_is_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `coupons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `coupons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`coupon_id` varchar(50) NOT NULL,
`code` varchar(50) NOT NULL,
`discount_type` enum('percentage','fixed') NOT NULL DEFAULT 'percentage',
`discount_value` decimal(10,2) NOT NULL,
`min_order_amount` decimal(10,2) DEFAULT NULL,
`max_uses` int(11) DEFAULT NULL,
`times_used` int(11) DEFAULT 0,
`is_active` tinyint(1) DEFAULT 1,
`starts_at` timestamp NULL DEFAULT NULL,
`expires_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `coupon_id` (`coupon_id`),
UNIQUE KEY `code` (`code`),
KEY `idx_code` (`code`),
KEY `idx_is_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `customers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `customers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` varchar(50) NOT NULL,
`email` varchar(255) NOT NULL,
`password_hash` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`shipping_address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`shipping_address`)),
`billing_address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`billing_address`)),
`wallet_balance` decimal(10,2) DEFAULT 0.00,
`reward_points` int(11) DEFAULT 0,
`lifetime_points` int(11) DEFAULT 0,
`loyalty_tier` varchar(20) DEFAULT 'bronze',
`is_guest` tinyint(1) DEFAULT 0,
`created_via` varchar(50) DEFAULT 'web',
`email_verified` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`is_active` tinyint(1) DEFAULT 1,
`addresses` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`addresses`)),
`preferences` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`preferences`)),
PRIMARY KEY (`id`),
UNIQUE KEY `customer_id` (`customer_id`),
UNIQUE KEY `email` (`email`),
KEY `idx_email` (`email`),
KEY `idx_customer_id` (`customer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `email_campaigns`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `email_campaigns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`campaign_id` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`content` text NOT NULL,
`recipient_type` enum('all','customers_only','subscribers_only') DEFAULT 'all',
`status` enum('draft','scheduled','sent','cancelled') DEFAULT 'draft',
`scheduled_at` timestamp NULL DEFAULT NULL,
`sent_at` timestamp NULL DEFAULT NULL,
`recipients_count` int(11) DEFAULT 0,
`opened_count` int(11) DEFAULT 0,
`clicked_count` int(11) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `campaign_id` (`campaign_id`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `email_subscribers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `email_subscribers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`is_active` tinyint(1) DEFAULT 1,
`source` varchar(50) DEFAULT 'website',
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
KEY `idx_is_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `gift_card_transactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `gift_card_transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gift_card_id` varchar(50) NOT NULL,
`order_id` varchar(50) DEFAULT NULL,
`amount` decimal(10,2) NOT NULL,
`balance_after` decimal(10,2) NOT NULL,
`type` enum('purchase','redemption','refund') NOT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `idx_gift_card_id` (`gift_card_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `gift_cards`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `gift_cards` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gift_card_id` varchar(50) NOT NULL,
`code` varchar(20) NOT NULL,
`initial_balance` decimal(10,2) NOT NULL,
`current_balance` decimal(10,2) NOT NULL,
`purchaser_email` varchar(255) DEFAULT NULL,
`recipient_email` varchar(255) DEFAULT NULL,
`recipient_name` varchar(255) DEFAULT NULL,
`message` text DEFAULT NULL,
`is_active` tinyint(1) DEFAULT 1,
`expires_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `gift_card_id` (`gift_card_id`),
UNIQUE KEY `code` (`code`),
KEY `idx_code` (`code`),
KEY `idx_is_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `homepage_splashes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `homepage_splashes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`splash_id` varchar(50) NOT NULL,
`icon` varchar(100) NOT NULL DEFAULT 'fas fa-star',
`image_url` varchar(500) DEFAULT NULL,
`title` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
`sort_order` int(11) DEFAULT 0,
`is_active` tinyint(1) DEFAULT 1,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `splash_id` (`splash_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `loyalty_settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `loyalty_settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`setting_key` varchar(100) NOT NULL,
`setting_value` text DEFAULT NULL,
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `loyalty_tiers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `loyalty_tiers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`min_points` int(11) NOT NULL DEFAULT 0,
`multiplier` decimal(3,2) DEFAULT 1.00,
`benefits` longtext DEFAULT NULL CHECK (json_valid(`benefits`)),
`color` varchar(20) DEFAULT '#gray',
`created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `loyalty_transactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `loyalty_transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`transaction_id` varchar(50) DEFAULT NULL,
`customer_id` varchar(50) NOT NULL,
`type` enum('earn','redeem','expire','adjust','birthday_bonus','referral_bonus','referral_welcome','tier_upgrade') DEFAULT NULL,
`points` int(11) NOT NULL,
`balance_after` int(11) NOT NULL DEFAULT 0,
`description` varchar(255) DEFAULT NULL,
`reference_amount` decimal(10,2) DEFAULT NULL,
`order_id` varchar(50) DEFAULT NULL,
`created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `transaction_id` (`transaction_id`),
KEY `idx_customer` (`customer_id`),
KEY `idx_created` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `order_items`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `order_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` varchar(50) NOT NULL,
`product_id` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`price` decimal(10,2) NOT NULL,
`quantity` int(11) NOT NULL,
`total` decimal(10,2) NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_order_id` (`order_id`),
KEY `idx_product_id` (`product_id`),
CONSTRAINT `order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` varchar(50) NOT NULL,
`order_number` varchar(20) NOT NULL,
`customer_id` varchar(50) DEFAULT NULL,
`customer_email` varchar(255) NOT NULL,
`customer_name` varchar(255) DEFAULT NULL,
`customer_phone` varchar(50) DEFAULT NULL,
`items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`items`)),
`subtotal` decimal(10,2) NOT NULL,
`shipping_cost` decimal(10,2) DEFAULT 0.00,
`tax` decimal(10,2) DEFAULT 0.00,
`discount` decimal(10,2) DEFAULT 0.00,
`gift_card_discount` decimal(10,2) DEFAULT 0.00,
`wallet_amount_used` decimal(10,2) DEFAULT 0.00,
`total` decimal(10,2) NOT NULL,
`shipping_address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`shipping_address`)),
`billing_address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`billing_address`)),
`shipping_method` varchar(50) DEFAULT NULL,
`payment_method` varchar(50) DEFAULT NULL,
`payment_status` enum('pending','paid','failed','refunded','partially_refunded') DEFAULT 'pending',
`order_status` enum('pending','confirmed','processing','shipped','delivered','cancelled','refunded') DEFAULT 'pending',
`stripe_session_id` varchar(255) DEFAULT NULL,
`stripe_payment_intent` varchar(255) DEFAULT NULL,
`tracking_number` varchar(100) DEFAULT NULL,
`tracking_url` varchar(500) DEFAULT NULL,
`notes` text DEFAULT NULL,
`is_pos_order` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `order_id` (`order_id`),
UNIQUE KEY `order_number` (`order_number`),
KEY `idx_order_id` (`order_id`),
KEY `idx_customer_id` (`customer_id`),
KEY `idx_customer_email` (`customer_email`),
KEY `idx_order_status` (`order_status`),
KEY `idx_payment_status` (`payment_status`),
KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `password_reset_tokens`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `password_reset_tokens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`user_type` enum('admin','customer') NOT NULL,
`expires_at` timestamp NOT NULL,
`used` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `idx_token` (`token`),
KEY `idx_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__bookmark`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__bookmark` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dbase` varchar(255) NOT NULL DEFAULT '',
`user` varchar(255) NOT NULL DEFAULT '',
`label` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
`query` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Bookmarks';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__central_columns`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__central_columns` (
`db_name` varchar(64) NOT NULL,
`col_name` varchar(64) NOT NULL,
`col_type` varchar(64) NOT NULL,
`col_length` text DEFAULT NULL,
`col_collation` varchar(64) NOT NULL,
`col_isNull` tinyint(1) NOT NULL,
`col_extra` varchar(255) DEFAULT '',
`col_default` text DEFAULT NULL,
PRIMARY KEY (`db_name`,`col_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Central list of columns';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__column_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__column_info` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`db_name` varchar(64) NOT NULL DEFAULT '',
`table_name` varchar(64) NOT NULL DEFAULT '',
`column_name` varchar(64) NOT NULL DEFAULT '',
`comment` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
`mimetype` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
`transformation` varchar(255) NOT NULL DEFAULT '',
`transformation_options` varchar(255) NOT NULL DEFAULT '',
`input_transformation` varchar(255) NOT NULL DEFAULT '',
`input_transformation_options` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Column information for phpMyAdmin';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__designer_settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__designer_settings` (
`username` varchar(64) NOT NULL,
`settings_data` text NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Settings related to Designer';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__export_templates`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__export_templates` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL,
`export_type` varchar(10) NOT NULL,
`template_name` varchar(64) NOT NULL,
`template_data` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Saved export templates';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__favorite`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__favorite` (
`username` varchar(64) NOT NULL,
`tables` text NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Favorite tables';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__history` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL DEFAULT '',
`db` varchar(64) NOT NULL DEFAULT '',
`table` varchar(64) NOT NULL DEFAULT '',
`timevalue` timestamp NOT NULL DEFAULT current_timestamp(),
`sqlquery` text NOT NULL,
PRIMARY KEY (`id`),
KEY `username` (`username`,`db`,`table`,`timevalue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='SQL history for phpMyAdmin';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__navigationhiding`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__navigationhiding` (
`username` varchar(64) NOT NULL,
`item_name` varchar(64) NOT NULL,
`item_type` varchar(64) NOT NULL,
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Hidden items of navigation tree';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__pdf_pages`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__pdf_pages` (
`db_name` varchar(64) NOT NULL DEFAULT '',
`page_nr` int(10) unsigned NOT NULL AUTO_INCREMENT,
`page_descr` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
PRIMARY KEY (`page_nr`),
KEY `db_name` (`db_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='PDF relation pages for phpMyAdmin';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__recent`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__recent` (
`username` varchar(64) NOT NULL,
`tables` text NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Recently accessed tables';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__relation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__relation` (
`master_db` varchar(64) NOT NULL DEFAULT '',
`master_table` varchar(64) NOT NULL DEFAULT '',
`master_field` varchar(64) NOT NULL DEFAULT '',
`foreign_db` varchar(64) NOT NULL DEFAULT '',
`foreign_table` varchar(64) NOT NULL DEFAULT '',
`foreign_field` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`master_db`,`master_table`,`master_field`),
KEY `foreign_field` (`foreign_db`,`foreign_table`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Relation table';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__savedsearches`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__savedsearches` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL DEFAULT '',
`db_name` varchar(64) NOT NULL DEFAULT '',
`search_name` varchar(64) NOT NULL DEFAULT '',
`search_data` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Saved searches';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__table_coords`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__table_coords` (
`db_name` varchar(64) NOT NULL DEFAULT '',
`table_name` varchar(64) NOT NULL DEFAULT '',
`pdf_page_number` int(11) NOT NULL DEFAULT 0,
`x` float unsigned NOT NULL DEFAULT 0,
`y` float unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Table coordinates for phpMyAdmin PDF output';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__table_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__table_info` (
`db_name` varchar(64) NOT NULL DEFAULT '',
`table_name` varchar(64) NOT NULL DEFAULT '',
`display_field` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Table information for phpMyAdmin';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__table_uiprefs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__table_uiprefs` (
`username` varchar(64) NOT NULL,
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`prefs` text NOT NULL,
`last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`username`,`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Tables'' UI preferences';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__tracking`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__tracking` (
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`version` int(10) unsigned NOT NULL,
`date_created` datetime NOT NULL,
`date_updated` datetime NOT NULL,
`schema_snapshot` text NOT NULL,
`schema_sql` text DEFAULT NULL,
`data_sql` longtext DEFAULT NULL,
`tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') DEFAULT NULL,
`tracking_active` int(1) unsigned NOT NULL DEFAULT 1,
PRIMARY KEY (`db_name`,`table_name`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Database changes tracking for phpMyAdmin';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__userconfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__userconfig` (
`username` varchar(64) NOT NULL,
`timevalue` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`config_data` text NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='User preferences storage for phpMyAdmin';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__usergroups`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__usergroups` (
`usergroup` varchar(64) NOT NULL,
`tab` varchar(64) NOT NULL,
`allowed` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`,`tab`,`allowed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='User groups with configured menu items';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `pma__users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `pma__users` (
`username` varchar(64) NOT NULL,
`usergroup` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`usergroup`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Users and their assignments to user groups';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `product_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_id` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
`sort_order` int(11) DEFAULT 0,
`is_active` tinyint(1) DEFAULT 1,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `type_id` (`type_id`),
UNIQUE KEY `slug` (`slug`),
KEY `idx_slug` (`slug`),
KEY `idx_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `products`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
`price` decimal(10,2) NOT NULL,
`sale_price` decimal(10,2) DEFAULT NULL,
`cost_price` decimal(10,2) DEFAULT NULL,
`sku` varchar(100) DEFAULT NULL,
`barcode` varchar(100) DEFAULT NULL,
`category` varchar(100) DEFAULT NULL,
`product_type_id` varchar(50) DEFAULT NULL,
`tags` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`tags`)),
`images` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`images`)),
`stock` int(11) DEFAULT 0,
`low_stock_threshold` int(11) DEFAULT 10,
`weight` decimal(10,2) DEFAULT NULL,
`dimensions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`dimensions`)),
`is_active` tinyint(1) DEFAULT 1,
`is_featured` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `product_id` (`product_id`),
KEY `idx_product_id` (`product_id`),
KEY `idx_category` (`category`),
KEY `idx_is_active` (`is_active`),
KEY `idx_type` (`product_type_id`),
FULLTEXT KEY `idx_search` (`name`,`description`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `referrals`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `referrals` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`referral_id` varchar(50) NOT NULL,
`referrer_customer_id` varchar(50) NOT NULL,
`referral_code` varchar(20) NOT NULL,
`referred_customer_id` varchar(50) DEFAULT NULL,
`referred_email` varchar(255) DEFAULT NULL,
`status` enum('pending','completed','expired') DEFAULT 'pending',
`reward_amount` decimal(10,2) DEFAULT 5.00,
`reward_given` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `referral_id` (`referral_id`),
UNIQUE KEY `referral_code` (`referral_code`),
KEY `idx_referral_code` (`referral_code`),
KEY `idx_referrer` (`referrer_customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `reviews`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `reviews` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`review_id` varchar(50) NOT NULL,
`product_id` varchar(50) NOT NULL,
`customer_id` varchar(50) DEFAULT NULL,
`customer_name` varchar(255) NOT NULL,
`customer_email` varchar(255) NOT NULL,
`rating` int(11) NOT NULL CHECK (`rating` >= 1 and `rating` <= 5),
`title` varchar(255) DEFAULT NULL,
`comment` text DEFAULT NULL,
`is_verified_purchase` tinyint(1) DEFAULT 0,
`is_approved` tinyint(1) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `review_id` (`review_id`),
KEY `idx_product_id` (`product_id`),
KEY `idx_is_approved` (`is_approved`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sessions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`session_id` varchar(128) NOT NULL,
`user_id` varchar(50) DEFAULT NULL,
`user_type` enum('admin','customer') DEFAULT NULL,
`data` text DEFAULT NULL,
`ip_address` varchar(45) DEFAULT NULL,
`user_agent` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`expires_at` timestamp NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `session_id` (`session_id`),
KEY `idx_session_id` (`session_id`),
KEY `idx_expires_at` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`setting_key` varchar(100) NOT NULL,
`setting_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`setting_value`)),
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `visitor_sessions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `visitor_sessions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`session_id` varchar(100) NOT NULL,
`visitor_id` varchar(50) NOT NULL,
`ip_address` varchar(45) DEFAULT NULL,
`user_agent` text DEFAULT NULL,
`current_page` varchar(500) DEFAULT NULL,
`referrer` varchar(500) DEFAULT NULL,
`country` varchar(100) DEFAULT NULL,
`city` varchar(100) DEFAULT NULL,
`is_active` tinyint(1) DEFAULT 1,
`page_views` int(11) DEFAULT 1,
`started_at` timestamp NULL DEFAULT current_timestamp(),
`last_activity` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `session_id` (`session_id`),
KEY `idx_is_active` (`is_active`),
KEY `idx_last_activity` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wallet_transactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `wallet_transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`transaction_id` varchar(50) NOT NULL,
`customer_id` varchar(50) NOT NULL,
`amount` decimal(10,2) NOT NULL,
`balance_after` decimal(10,2) NOT NULL,
`type` enum('deposit','withdrawal','purchase','refund','reward','loyalty_redemption','credit','debit') DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`order_id` varchar(50) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `transaction_id` (`transaction_id`),
KEY `idx_customer_id` (`customer_id`),
KEY `idx_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wishlist`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `wishlist` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` varchar(50) NOT NULL,
`product_id` varchar(50) NOT NULL,
`created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `unique_wishlist` (`customer_id`,`product_id`),
KEY `idx_customer` (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!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 */;