Files
co-lite/openspec/changes/add-release-ci-packaging/sql/01-schema.sql
T

6027 lines
226 KiB
SQL

-- Production package for the DBA: same content as local/seed/01-schema.sql, kept in step with it. Any "local dev" note below comes from that copy; this file is meant for production.
-- Local dev only. Table structure, triggers and routines of the five Co-Lite service schemas,
-- from a Tastefully schema-only dump (2026-11-26). AUTO_INCREMENT counters and DEFINER users removed.
-- Stress-test procedures proc_create_user and proc_create_member removed (they create users with a fixed password).
USE `service-system`;
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: service-system
-- ------------------------------------------------------
-- Server version 8.4.8
/*!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 */;
/*!50503 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 */;
--
-- Table structure for table `address`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `address` (
`id` bigint NOT NULL AUTO_INCREMENT,
`country_code` char(5) DEFAULT NULL,
`state_tag` varchar(50) DEFAULT NULL,
`city_tag` varchar(50) DEFAULT NULL,
`province_tag` varchar(50) DEFAULT NULL,
`street_tag` varchar(50) DEFAULT NULL,
`state_status` char(1) DEFAULT 'N',
`city_status` char(1) DEFAULT 'N',
`province_status` char(1) DEFAULT 'N',
`street_status` char(1) DEFAULT 'N',
`transaction_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(50) DEFAULT NULL,
`status` char(1) DEFAULT 'N',
PRIMARY KEY (`id`),
UNIQUE KEY `country_code_UNIQUE` (`country_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `album`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `album` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL DEFAULT '0',
`name` varchar(255) DEFAULT NULL,
`description` text,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`sort_index` int NOT NULL DEFAULT '0',
`create_date_time` datetime DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_ENABLED` (`enabled`,`sort_index`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `album_detail`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `album_detail` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL DEFAULT '0',
`album_uuid` decimal(32,0) NOT NULL DEFAULT '0',
`upload_path` text,
`description` varchar(255) DEFAULT NULL,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`sort_index` int NOT NULL DEFAULT '0',
`done_by` varchar(255) DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`is_thumbnail` varchar(5) NOT NULL DEFAULT 'N',
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_ALBUM` (`album_uuid`,`enabled`,`sort_index`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `app_banner`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `app_banner` (
`id` bigint NOT NULL AUTO_INCREMENT,
`message` varchar(500) COLLATE utf8mb4_general_ci NOT NULL,
`link_url` varchar(1000) COLLATE utf8mb4_general_ci DEFAULT NULL,
`style` varchar(20) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'INFO',
`date_from` datetime DEFAULT NULL,
`date_to` datetime DEFAULT NULL,
`enabled` bit(1) NOT NULL DEFAULT b'0',
`sort_index` int NOT NULL DEFAULT '0',
`create_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_app_banner_enabled_sort` (`enabled`,`sort_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `app_promo`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `app_promo` (
`id` bigint NOT NULL AUTO_INCREMENT,
`media_type` varchar(16) COLLATE utf8mb4_general_ci NOT NULL,
`media_url` varchar(1000) COLLATE utf8mb4_general_ci NOT NULL,
`link_url` varchar(1000) COLLATE utf8mb4_general_ci DEFAULT NULL,
`caption` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL,
`alt_text` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL,
`date_from` datetime DEFAULT NULL,
`date_to` datetime DEFAULT NULL,
`enabled` bit(1) NOT NULL DEFAULT b'0',
`sort_index` int NOT NULL DEFAULT '0',
`create_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_app_promo_enabled_sort` (`enabled`,`sort_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `app_version`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `app_version` (
`id` int NOT NULL AUTO_INCREMENT,
`app_os` varchar(45) NOT NULL,
`app_version` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `archived_augexpo2024_user`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `archived_augexpo2024_user` (
`id` bigint NOT NULL DEFAULT '0',
`email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`email_verified` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
`phone_verified` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
`enabled` bit(1) NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`password` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`password_secondary` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`password_emrm` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`surname` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`username` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`groupid` int DEFAULT NULL,
`branchid` int NOT NULL,
`master` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`login` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 'N',
`status` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'P',
`last_modified_pwd` datetime DEFAULT NULL,
`type` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 'D',
`create_by` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`create_date` datetime DEFAULT NULL,
`done_by` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`from_emrm` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
`lastmodify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `article`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `article` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL DEFAULT '0',
`week` int DEFAULT NULL,
`week_to` int DEFAULT NULL,
`image_url` varchar(255) DEFAULT NULL,
`status` varchar(3) DEFAULT NULL,
`type` varchar(3) DEFAULT NULL,
`create_by` varchar(100) DEFAULT NULL,
`done_by` varchar(100) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `article_content`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `article_content` (
`id` bigint NOT NULL AUTO_INCREMENT,
`article_id` bigint DEFAULT NULL,
`language` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`image_url` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bank`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bank` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL,
`branch_code` varchar(20) DEFAULT '',
`swift_code` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`message_tag` varchar(255) DEFAULT 'DEFAULT',
`country_id` bigint NOT NULL DEFAULT '0',
`credit_card_flag` varchar(5) DEFAULT NULL,
`bankid` varchar(255) DEFAULT NULL,
`bnm_code` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bank_backup`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bank_backup` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL,
`branch_code` varchar(20) DEFAULT '',
`swift_code` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`message_tag` varchar(255) DEFAULT 'DEFAULT',
`country_id` bigint NOT NULL DEFAULT '0',
`credit_card_flag` varchar(5) DEFAULT NULL,
`bankid` varchar(255) DEFAULT NULL,
`bnm_code` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bulletin`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bulletin` (
`id` bigint NOT NULL AUTO_INCREMENT,
`title` varchar(250) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`date_from` datetime NOT NULL,
`date_to` datetime NOT NULL,
`image_url` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`status` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`type` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`sort_index` int NOT NULL DEFAULT '0',
`create_by` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`done_by` varchar(100) DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bulletin_area`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bulletin_area` (
`id` bigint NOT NULL AUTO_INCREMENT,
`bulletin_id` bigint NOT NULL,
`area` varchar(3) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bulletin_country`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bulletin_country` (
`id` bigint NOT NULL AUTO_INCREMENT,
`bulletin_id` bigint NOT NULL,
`prefix` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `config_country`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `config_country` (
`id` bigint NOT NULL AUTO_INCREMENT,
`type` varchar(255) DEFAULT '',
`location_hierarchy_id` bigint DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `contact_us`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `contact_us` (
`id` int NOT NULL AUTO_INCREMENT,
`content` text,
`status` varchar(3) DEFAULT NULL,
`ordering` int DEFAULT '99',
`done_by` varchar(45) DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_marrital_status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_marrital_status` (
`config_id` bigint NOT NULL,
`marrital_status_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`marrital_status_id`),
KEY `FKt5v0rrweyk393bdgt107vdx0x` (`config_id`),
KEY `FKg63iendaoyh04b95ykqise6qh` (`marrital_status_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_nationality`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_nationality` (
`config_id` bigint NOT NULL,
`nationality_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`nationality_id`),
KEY `FKt6v0rrweyk564bdgt107vdx0x` (`config_id`),
KEY `FKg73iendaoyh04b43ykqise6qh` (`nationality_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_preferred_language`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_preferred_language` (
`config_id` bigint NOT NULL,
`preferred_language_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`preferred_language_id`),
KEY `FKt18v0rrweyk394bdgt107vdx0x` (`config_id`),
KEY `FKg193iendaoyh04b96ykqise6qh` (`preferred_language_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_race`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_race` (
`config_id` bigint NOT NULL,
`race_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`race_id`),
KEY `FKt6v0rrweyk393bdgt107vdx0x` (`config_id`),
KEY `FKg73iendaoyh04b95ykqise6qh` (`race_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_sales_kit`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_sales_kit` (
`config_id` bigint NOT NULL,
`product_variation_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`product_variation_id`),
KEY `FKt6v0rrweyk393bdgt107vdx0x` (`config_id`),
KEY `FKg73iendaoyh04b95ykqise6qh` (`product_variation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_salutation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_salutation` (
`config_id` bigint NOT NULL,
`salutation_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`salutation_id`),
KEY `FKt8v0rrweyk393bdgt107vdx0x` (`config_id`),
KEY `FKg93iendaoyh04b95ykqise6qh` (`salutation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country_taxation_setup`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `country_taxation_setup` (
`config_id` bigint NOT NULL,
`taxation_setup_id` bigint NOT NULL,
PRIMARY KEY (`config_id`,`taxation_setup_id`),
KEY `FKt18v0rrweyk393bdgt107vdx0x` (`config_id`),
KEY `FKg193iendaoyh04b95ykqise6qh` (`taxation_setup_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `currency`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `currency` (
`id` bigint NOT NULL AUTO_INCREMENT,
`country_code` char(5) DEFAULT NULL,
`currency_symbol` varchar(10) DEFAULT '',
`type` varchar(45) DEFAULT 'TRX',
`rate` decimal(12,5) NOT NULL DEFAULT '0.00000',
`effective_time` datetime DEFAULT NULL,
`done_by` varchar(50) DEFAULT NULL,
`status` char(1) DEFAULT 'N',
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_charges`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_charges` (
`id` int NOT NULL AUTO_INCREMENT,
`country_from` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`country_to` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`effective_date` datetime DEFAULT NULL,
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin,
`courier_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`currency_symbol` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`free_delivery_charges` tinyint DEFAULT NULL,
`use_flat_rate` tinyint DEFAULT NULL,
`use_weight` tinyint DEFAULT NULL,
`use_volume` tinyint DEFAULT NULL,
`use_packaging` tinyint DEFAULT NULL,
`status` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`createby` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_charges_campaign`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_charges_campaign` (
`id` int NOT NULL AUTO_INCREMENT,
`effective_date_from` datetime DEFAULT NULL,
`effective_date_to` datetime DEFAULT NULL,
`geo_location_id` varchar(10) DEFAULT NULL,
`price_apply` double DEFAULT NULL,
`discount_rate` double DEFAULT NULL,
`status` varchar(5) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`create_by` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_charges_zone`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_charges_zone` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_charges_id` int DEFAULT NULL,
`geo_location_id` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`status` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_flat_rate_charges`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_flat_rate_charges` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_charges_id` int DEFAULT NULL,
`flat_rate_base_type` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`only_apply_to_amount_below` double DEFAULT '0',
`flat_rate_charges` double DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_packaging_charges`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_packaging_charges` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_charges_id` int DEFAULT NULL,
`status` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_packaging_charges_range`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_packaging_charges_range` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_packaging_charges_id` int DEFAULT NULL,
`range_from` double DEFAULT NULL,
`range_to` double DEFAULT NULL,
`charges` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_volume_charges`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_volume_charges` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_charges_id` int DEFAULT NULL,
`volume_type` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`only_apply_to_volume_more_than` double DEFAULT NULL,
`charges_type1` double DEFAULT NULL,
`first_volume` double DEFAULT NULL,
`first_volume_charges` double DEFAULT NULL,
`sub_sequent_volume` double DEFAULT NULL,
`sub_sequent_volume_charges` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `delivery_weight_charges`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `delivery_weight_charges` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_charges_id` int DEFAULT NULL,
`weight_type` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
`only_apply_to_weight_more_than` double DEFAULT NULL,
`charges_type1` double DEFAULT NULL,
`first_weight` double DEFAULT NULL,
`first_weight_charges` double DEFAULT NULL,
`sub_sequent_weight` double DEFAULT NULL,
`sub_sequent_weight_charges` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_schedule`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_schedule` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL DEFAULT '0',
`upload_path` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`venue` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`event_date` date DEFAULT NULL,
`event_end_date` date DEFAULT NULL,
`event_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`enabled` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Y',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `event_schedule_unique` (`uuid`),
KEY `idx_enabled` (`enabled`,`event_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `generic_hierarchy`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `generic_hierarchy` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL,
`parent_uuid` decimal(32,0) NOT NULL DEFAULT '0',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message_tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sort_index` bigint DEFAULT '0',
`hierarchy_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NA',
`status` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
`sys_managed` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_SEARCH` (`hierarchy_type`,`status`,`parent_uuid`),
KEY `IDX_UUID` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `generic_post`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `generic_post` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
`sys_managed` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_STATUS` (`status`),
KEY `IDX_UUID` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `generic_post_content`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `generic_post_content` (
`id` bigint NOT NULL AUTO_INCREMENT,
`post_uuid` decimal(32,0) NOT NULL,
`locale` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'en_US',
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`json_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE_POST_LOCALE` (`post_uuid`,`locale`),
KEY `IDX_POST` (`post_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `geo_location_hierarchy`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `geo_location_hierarchy` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` json NOT NULL,
`trace_key` varchar(128) DEFAULT NULL,
`parent_id` int NOT NULL,
`status` varchar(3) NOT NULL DEFAULT 'Y',
`type` varchar(3) NOT NULL,
`user_minimal_until_type` varchar(3) DEFAULT NULL,
`post_code` varchar(10) DEFAULT NULL COMMENT 'Primary postcode of this node; NULL = unknown',
PRIMARY KEY (`id`),
KEY `IDX_PARENT_STATUS` (`parent_id`,`status`),
KEY `IDX_TRACE_KEY` (`trace_key`),
KEY `IDX_TYPE` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `help_center_post`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `help_center_post` (
`id` bigint NOT NULL AUTO_INCREMENT,
`generic_hierarchy_uuid` decimal(32,0) NOT NULL,
`generic_post_uuid` decimal(32,0) DEFAULT '0',
`redirect_url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`enabled` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE_HIERARCHY` (`generic_hierarchy_uuid`),
KEY `IDX_SEARCH` (`generic_hierarchy_uuid`,`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `indonesia_city_code`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `indonesia_city_code` (
`city_code` varchar(45) NOT NULL,
`sub_district` varchar(100) DEFAULT NULL,
`geo_location_id` varchar(45) DEFAULT NULL,
PRIMARY KEY (`city_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `location_hierarchy`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `location_hierarchy` (
`id` bigint NOT NULL AUTO_INCREMENT,
`old_code` varchar(50) DEFAULT NULL,
`code` varchar(50) NOT NULL,
`name` varchar(100) NOT NULL,
`trace_key` text,
`type` varchar(3) NOT NULL,
`status` varchar(3) NOT NULL DEFAULT 'P',
`parent` int NOT NULL,
`warehouse_store` bigint DEFAULT '0',
`document_header_path` text,
`invoice_prefix` varchar(50) DEFAULT NULL,
`invoice_footer` json DEFAULT NULL,
`delivery_order_prefix` varchar(50) DEFAULT NULL,
`back_order` char(1) DEFAULT 'N',
`address_country` bigint DEFAULT '0',
`address_text` text,
`bank_search` varchar(5) DEFAULT 'N',
`post_code` varchar(5) DEFAULT 'N',
`other_name` varchar(5) DEFAULT 'N',
`message_tag_other_name` varchar(100) DEFAULT '',
`message_tag_other_name_placeholder` varchar(100) DEFAULT '',
`message_tag_nric_error` varchar(100) DEFAULT '',
`mpay` varchar(5) NOT NULL DEFAULT 'N',
`eazy_payment` varchar(5) NOT NULL DEFAULT 'N',
`kyc_required` varchar(5) DEFAULT 'Y',
`done_by` varchar(50) DEFAULT '',
`last_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `code_UNIQUE` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `log_maintenance_mode`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `log_maintenance_mode` (
`id` bigint NOT NULL AUTO_INCREMENT,
`source_platform` varchar(20) DEFAULT NULL,
`flag_yes_no` varchar(5) DEFAULT 'N',
`done_by` varchar(50) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `marrital_status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `marrital_status` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
`message_tag` varchar(255) DEFAULT '',
`spouse_required` varchar(5) DEFAULT 'N',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_MarritalStatusCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `message`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `message` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`content` json DEFAULT NULL,
`area` varchar(3) DEFAULT 'A',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_code_area` (`code`,`area`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `module`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `module` (
`id` int NOT NULL,
`name` varchar(100) NOT NULL,
`desc` varchar(150) NOT NULL,
`area` varchar(3) NOT NULL DEFAULT 'A',
`type` varchar(3) NOT NULL,
`parent` int NOT NULL,
`url` varchar(200) DEFAULT NULL,
`icon_name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `modules_roles`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `modules_roles` (
`module_id` int NOT NULL,
`role_id` int NOT NULL,
PRIMARY KEY (`module_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `nationality`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `nationality` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL,
`iso_code` varchar(50) DEFAULT '',
`name` varchar(255) DEFAULT NULL,
`message_tag` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `code_UNIQUE` (`code`),
UNIQUE KEY `iso_code_UNIQUE` (`iso_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `notification`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `notification` (
`id` bigint NOT NULL AUTO_INCREMENT,
`receiver` varchar(45) DEFAULT NULL,
`message` text,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `one_time_password`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `one_time_password` (
`id` bigint NOT NULL AUTO_INCREMENT,
`identity_ref` varchar(255) DEFAULT NULL,
`short_ref` varchar(45) DEFAULT NULL,
`code` varchar(255) DEFAULT NULL,
`password` text,
`status` varchar(5) DEFAULT 'Y',
`expiry_time` datetime DEFAULT NULL,
`create_date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_CODE` (`code`),
KEY `IDX_IDENTITY_VALID` (`identity_ref`,`status`,`expiry_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `pickup_point_location`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pickup_point_location` (
`id` int NOT NULL AUTO_INCREMENT,
`pickup_point_type_id` int DEFAULT NULL,
`code` varchar(45) DEFAULT NULL,
`name` text,
`address` text,
`remark` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `pickup_point_osn`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pickup_point_osn` (
`id` int NOT NULL AUTO_INCREMENT,
`code` varchar(45) DEFAULT NULL,
`name` text,
`address` text,
`remark` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `pickup_point_type`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pickup_point_type` (
`id` int NOT NULL AUTO_INCREMENT,
`delivery_charges_id` int DEFAULT NULL,
`code` varchar(45) DEFAULT NULL,
`name` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `preferred_language`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `preferred_language` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_RaceCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `print_ticket`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `print_ticket` (
`id` bigint NOT NULL AUTO_INCREMENT,
`event` varchar(45) DEFAULT NULL,
`counter_id` varchar(45) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
`country` varchar(45) DEFAULT NULL,
`docno` varchar(45) DEFAULT NULL,
`category` varchar(45) DEFAULT NULL,
`status` char(1) DEFAULT NULL,
`done_by` varchar(100) DEFAULT NULL,
`amount` double(14,2) NOT NULL DEFAULT '0.00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `product_variation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_variation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`product_id` bigint DEFAULT NULL,
`last_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `public_holiday`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `public_holiday` (
`id` int NOT NULL AUTO_INCREMENT,
`country` text,
`date` text,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `purchaser_draw`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `purchaser_draw` (
`id` bigint NOT NULL AUTO_INCREMENT,
`event` varchar(45) DEFAULT NULL,
`country` varchar(45) DEFAULT NULL,
`category` varchar(45) DEFAULT NULL,
`status` char(1) DEFAULT NULL,
`done_by` varchar(100) DEFAULT NULL,
`update_by` varchar(100) DEFAULT NULL,
`invoice_date_from` timestamp NULL DEFAULT NULL,
`invoice_date_to` timestamp NULL DEFAULT NULL,
`amount` double(14,2) DEFAULT NULL,
`prefix` varchar(45) DEFAULT NULL,
`digi_length` int DEFAULT '0',
`starting_no` int DEFAULT '0',
`prefix_position` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `race`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `race` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
`message_tag` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_RaceCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `reason_code`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `reason_code` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(50) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`function` varchar(5) DEFAULT NULL,
`status` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `resources`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `resources` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`description` varchar(256) DEFAULT NULL,
`status` varchar(3) DEFAULT NULL,
`lastmodify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`resources_category_id` bigint NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `resources_category`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `resources_category` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`status` varchar(3) NOT NULL DEFAULT 'N',
`type` varchar(3) NOT NULL DEFAULT 'N',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `resources_country`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `resources_country` (
`id` bigint NOT NULL AUTO_INCREMENT,
`prefix` varchar(20) NOT NULL,
`resources_id` bigint NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `resources_file`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `resources_file` (
`id` int NOT NULL AUTO_INCREMENT,
`file_type` varchar(45) NOT NULL,
`url` varchar(128) NOT NULL,
`file_name` varchar(128) NOT NULL,
`lang` varchar(255) NOT NULL,
`resources_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`parentid` bigint DEFAULT NULL,
`level` int DEFAULT NULL,
`tracekey` text,
`create_by` varchar(100) NOT NULL,
`create_date` datetime DEFAULT NULL,
`done_by` varchar(100) NOT NULL,
`lastmodify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `salutation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `salutation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
`message_tag` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_SalutionCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `service_point_details`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `service_point_details` (
`sp_id` bigint NOT NULL AUTO_INCREMENT,
`sp_code` varchar(20) DEFAULT NULL,
`sp_storeName` varchar(100) DEFAULT NULL,
`sp_smcode` varchar(10) DEFAULT NULL,
`sp_district` varchar(100) DEFAULT NULL,
`sp_address` text,
`sp_locale` varchar(200) DEFAULT NULL,
`sp_bhweekday` varchar(200) DEFAULT NULL,
`sp_bhweekend` varchar(200) DEFAULT NULL,
PRIMARY KEY (`sp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `service_point_main`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `service_point_main` (
`sm_code` varchar(10) NOT NULL,
`sm_name` varchar(200) DEFAULT NULL,
`sm_locale` varchar(200) DEFAULT NULL,
PRIMARY KEY (`sm_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `supported_devices`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `supported_devices` (
`Retail_Branding` varchar(100) DEFAULT NULL,
`Marketing_Name` varchar(100) DEFAULT NULL,
`Device` varchar(100) DEFAULT NULL,
`Model` varchar(100) DEFAULT NULL,
`column_4` varchar(100) DEFAULT NULL,
KEY `IDX_MODEL` (`Model`),
KEY `IDX_DEVICE` (`Device`),
KEY `IDX_BRAND` (`Retail_Branding`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `supported_user_agent`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `supported_user_agent` (
`id` bigint NOT NULL AUTO_INCREMENT,
`user_agent` text,
`user_stack` text,
`browser_name` varchar(250) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.browser.name'))) STORED,
`browser_version` varchar(250) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.browser.version_major'))) STORED,
`os_name` varchar(250) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.os.name'))) STORED,
`device_name` varchar(250) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.device.name'))) STORED,
`device_type` varchar(250) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.device.type'))) STORED,
`device_brand` varchar(250) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.device.brand'))) STORED,
`is_mobile_device` varchar(10) GENERATED ALWAYS AS (json_unquote(json_extract(`user_stack`,_utf8mb4'$.device.is_mobile_device'))) STORED,
PRIMARY KEY (`id`),
FULLTEXT KEY `IDX_FULLTEXT_UA` (`user_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `survey_rating`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `survey_rating` (
`id` bigint NOT NULL AUTO_INCREMENT,
`stmt_date` date DEFAULT NULL,
`country_code` varchar(45) DEFAULT NULL,
`member_code` varchar(255) DEFAULT '',
`date_join` date DEFAULT NULL,
`transaction_date_time` datetime DEFAULT NULL,
`action_performed` varchar(5) DEFAULT 'N',
`star_rated` int DEFAULT '0',
`review` text,
`source_platform` varchar(10) DEFAULT 'MB',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_STMT_DATE_MBR_CODE` (`stmt_date`,`member_code`),
KEY `IDX_JOIN_DATE` (`date_join`),
KEY `IDX_TRX_DATE_TIME` (`transaction_date_time`),
KEY `IDX_CTRY_CODE` (`country_code`),
KEY `IDX_MBR_CODE` (`member_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `system_property`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `system_property` (
`id` bigint NOT NULL AUTO_INCREMENT,
`param` varchar(60) NOT NULL,
`status` varchar(3) NOT NULL,
`type` varchar(60) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taxation_setup`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `taxation_setup` (
`id` bigint NOT NULL AUTO_INCREMENT,
`message_tag` varchar(255) DEFAULT '',
`description` text,
`percentage` decimal(10,2) DEFAULT '0.00',
`inclusive` varchar(5) DEFAULT 'N',
`done_by` varchar(50) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `undo_log`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `undo_log` (
`id` bigint NOT NULL AUTO_INCREMENT,
`branch_id` bigint NOT NULL,
`xid` varchar(100) NOT NULL,
`context` varchar(128) NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int NOT NULL,
`log_created` datetime NOT NULL,
`log_modified` datetime NOT NULL,
`ext` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` bigint NOT NULL AUTO_INCREMENT,
`email` varchar(255) DEFAULT NULL,
`email_verified` varchar(5) NOT NULL DEFAULT 'N',
`phone_verified` varchar(5) NOT NULL DEFAULT 'N',
`enabled` bit(1) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`password` varchar(60) DEFAULT NULL,
`password_secondary` varchar(60) DEFAULT NULL,
`password_emrm` varchar(200) DEFAULT NULL,
`surname` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`groupid` int DEFAULT NULL,
`branchid` int NOT NULL,
`master` varchar(255) DEFAULT NULL,
`login` varchar(3) DEFAULT 'N',
`status` varchar(3) NOT NULL DEFAULT 'P',
`last_modified_pwd` datetime DEFAULT NULL,
`type` varchar(5) DEFAULT 'D',
`create_by` varchar(100) NOT NULL,
`create_date` datetime DEFAULT NULL,
`done_by` varchar(100) NOT NULL,
`from_emrm` varchar(5) NOT NULL DEFAULT 'N',
`lastmodify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `username_UNIQUE` (`username`),
KEY `idx_master_username` (`master`,`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_group`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_group` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`create_by` varchar(100) NOT NULL,
`create_date` datetime DEFAULT NULL,
`done_by` varchar(100) NOT NULL,
`lastmodify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_group_roles`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_group_roles` (
`user_group_id` bigint NOT NULL,
`role_id` bigint NOT NULL,
PRIMARY KEY (`user_group_id`,`role_id`),
KEY `IDX_UG_ROLES` (`role_id`),
KEY `IDX_UG_USER_GROUPID` (`user_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users_roles`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users_roles` (
`user_id` bigint NOT NULL,
`role_id` bigint NOT NULL,
PRIMARY KEY (`user_id`,`role_id`),
KEY `FKt4v0rrweyk393bdgt107vdx0x` (`role_id`),
KEY `FKgd3iendaoyh04b95ykqise6qh` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping routines for database 'service-system'
--
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `title_case`(str TEXT) RETURNS text CHARSET latin1
DETERMINISTIC
BEGIN
DECLARE result TEXT DEFAULT '';
DECLARE i INT DEFAULT 1;
DECLARE word TEXT;
DECLARE word_start INT;
DECLARE word_end INT;
DECLARE first_word BOOLEAN DEFAULT TRUE;
IF str IS NULL THEN
RETURN NULL;
END IF;
SET str = LOWER(str);
WHILE i <= LENGTH(str) DO
SET word_start = i;
SET word_end = LOCATE(' ', str, i);
IF word_end = 0 THEN
SET word_end = LENGTH(str) + 1;
END IF;
SET word = SUBSTRING(str, word_start, word_end - word_start);
IF LENGTH(word) > 0 THEN
IF first_word THEN
SET result = CONCAT(UPPER(SUBSTRING(word, 1, 1)), SUBSTRING(word, 2));
SET first_word = FALSE;
ELSE
SET result = CONCAT(result, ' ', CONCAT(UPPER(SUBSTRING(word, 1, 1)), SUBSTRING(word, 2)));
END IF;
END IF;
SET i = word_end + 1;
END WHILE;
RETURN result;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `toTitleCase`(input_string VARCHAR(255)) RETURNS varchar(255) CHARSET latin1
DETERMINISTIC
BEGIN
DECLARE i INT DEFAULT 1;
DECLARE result_string VARCHAR(255);
IF input_string IS NULL THEN
RETURN NULL;
END IF;
-- Start with the entire string in lowercase
SET result_string = LOWER(input_string);
-- Loop through the string, character by character
WHILE i <= CHAR_LENGTH(result_string) DO
-- Check if it's the first character OR if the previous character was a space
IF i = 1 OR SUBSTRING(result_string, i - 1, 1) = ' ' THEN
-- If it is, replace the current character with its uppercase version
SET result_string = CONCAT(
SUBSTRING(result_string, 1, i - 1),
UPPER(SUBSTRING(result_string, i, 1)),
SUBSTRING(result_string, i + 1)
);
END IF;
SET i = i + 1;
END WHILE;
RETURN result_string;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!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 */;
-- Dump completed on 2026-11-26 16:13:58
USE `service-counter`;
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: service-counter
-- ------------------------------------------------------
-- Server version 8.4.8
/*!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 */;
/*!50503 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 */;
--
-- Table structure for table `aa_stresstest`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `aa_stresstest` (
`id` bigint NOT NULL AUTO_INCREMENT,
`create_date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `archived_augexpo2024_event_gift_with_purchase`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `archived_augexpo2024_event_gift_with_purchase` (
`id` bigint NOT NULL DEFAULT '0',
`event_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`redeemed_count` int DEFAULT '1',
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `archived_augexpo2024_event_lucky_draw_ticket`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `archived_augexpo2024_event_lucky_draw_ticket` (
`id` bigint NOT NULL DEFAULT '0',
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`receipt_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`member_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`ticket_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`enabled` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'Y',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `archived_augexpo2024_event_receipt`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `archived_augexpo2024_event_receipt` (
`id` bigint NOT NULL DEFAULT '0',
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`member_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`upload_date_time` datetime DEFAULT NULL,
`upload_path` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`purchase_amount` decimal(14,2) DEFAULT '0.00',
`review_status` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'P',
`review_remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`reviewed_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`reviewed_date_time` datetime DEFAULT NULL,
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`done_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `archived_augexpo2024_event_redeem_code`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `archived_augexpo2024_event_redeem_code` (
`id` bigint NOT NULL DEFAULT '0',
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL DEFAULT '0',
`stockist_uuid` bigint NOT NULL DEFAULT '0',
`member_uuid` bigint NOT NULL DEFAULT '0',
`redeem_code` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`redeem_status` varchar(5) NOT NULL DEFAULT 'Y',
`redeemed_date_time` datetime DEFAULT NULL,
`expiry_date_time` datetime DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `back_order_missing`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `back_order_missing` (
`id` int NOT NULL AUTO_INCREMENT,
`uuid` varchar(100) DEFAULT NULL,
`product_code` varchar(45) DEFAULT NULL,
`product_name` varchar(255) DEFAULT NULL,
`sku_code` varchar(45) DEFAULT NULL,
`sku_name` varchar(255) DEFAULT NULL,
`qty` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cart`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cart` (
`id` bigint NOT NULL AUTO_INCREMENT,
`member_id` varchar(45) DEFAULT NULL,
`variation_id` varchar(45) DEFAULT NULL,
`quantity` int DEFAULT NULL,
`is_sales_kit` tinyint DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE_M_V` (`member_id`,`variation_id`),
KEY `IDX_M_V` (`member_id`,`variation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `check_in_booth`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `check_in_booth` (
`id` bigint NOT NULL AUTO_INCREMENT,
`event_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`stockist_uuid` bigint NOT NULL,
`check_in_date_time` datetime DEFAULT NULL,
`check_in_date` date DEFAULT NULL,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_BOOTH_MEMBER` (`event_uuid`,`member_uuid`,`stockist_uuid`,`check_in_date_time`),
KEY `IDX_CHECK_IN_DATE` (`check_in_date`),
KEY `IDX_MEMBER` (`member_uuid`),
KEY `IDX_EVENT` (`event_uuid`),
KEY `IDX_STOCKIST` (`stockist_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `check_in_event`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `check_in_event` (
`id` bigint NOT NULL AUTO_INCREMENT,
`event_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`check_in_date_time` datetime DEFAULT NULL,
`check_in_date` date DEFAULT NULL,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(255) DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_EVENT_MEMBER` (`event_uuid`,`member_uuid`,`check_in_date_time`),
KEY `IDX_CHECK_IN_DATE` (`check_in_date`),
KEY `IDX_EVENT` (`event_uuid`),
KEY `IDX_MEMBER` (`member_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `credit_note`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `credit_note` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` varchar(50) DEFAULT NULL,
`effective_buyer_code` varchar(50) DEFAULT NULL,
`country_code` varchar(20) DEFAULT '',
`branch_code` varchar(20) DEFAULT '',
`document_no` varchar(200) DEFAULT NULL,
`bonus_date` date DEFAULT NULL,
`bonus_date_remark` varchar(250) DEFAULT NULL,
`transaction_date_time` datetime DEFAULT NULL,
`trx_type` varchar(20) DEFAULT NULL,
`credit_note_remarks` text,
`order_id` bigint DEFAULT '0',
`stock_return_id` bigint DEFAULT '0',
`currency_symbol` varchar(20) DEFAULT '',
`currency_rate` decimal(12,4) DEFAULT '0.0000',
`shipping_cost` decimal(14,2) DEFAULT '0.00',
`total_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
`rounding_adjustment` decimal(12,2) DEFAULT '0.00',
`admin_fee` decimal(12,2) DEFAULT '0.00',
`grand_total` decimal(12,2) DEFAULT '0.00',
`total_bv` decimal(12,2) NOT NULL DEFAULT '0.00',
`total_sv` decimal(12,2) NOT NULL DEFAULT '0.00',
`print_count` int DEFAULT '0',
`done_by` varchar(255) DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_TRNX_DATE` (`transaction_date_time`),
KEY `IDX_BNS_DATE` (`bonus_date`),
KEY `IDX_EFF_BUYER` (`effective_buyer_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `generate_document_no_credit_note` BEFORE INSERT ON `credit_note` FOR EACH ROW BEGIN
DECLARE V_DOCUMENT_ID BIGINT DEFAULT 0;
DECLARE V_RUNNING_NO BIGINT DEFAULT 0;
DECLARE V_TRANSACTION_DATE DATE;
DECLARE V_DOCUMENT_NO VARCHAR(50);
DECLARE V_DATE_PREFIX VARCHAR(50);
DECLARE V_INVOICE_PREFIX VARCHAR(10);
IF(NEW.document_no IS NULL OR NEW.document_no='') THEN
SET V_INVOICE_PREFIX='CN';
IF NOT EXISTS (
SELECT (1) FROM `document_running_no` doc
WHERE doc.`branch_code`=NEW.branch_code
AND doc.`invoice_prefix` = V_INVOICE_PREFIX
AND YEAR(doc.`create_date`)=YEAR(NEW.transaction_date_time)
AND MONTH(doc.`create_date`)=MONTH(NEW.transaction_date_time)) THEN
INSERT INTO `document_running_no`
(`create_date`,`branch_code`, `invoice_prefix`, `running_no`)
VALUES
(DATE(NEW.transaction_date_time),NEW.branch_code, V_INVOICE_PREFIX, 0);
END IF;
SELECT `id`,`running_no`,DATE_FORMAT(`create_date`, '%y%m')
into V_DOCUMENT_ID, V_RUNNING_NO, V_DATE_PREFIX
from `document_running_no` doc
WHERE doc.`branch_code`=NEW.branch_code
AND doc.`invoice_prefix` = V_INVOICE_PREFIX
AND YEAR(doc.`create_date`)=YEAR(NEW.transaction_date_time)
AND MONTH(doc.`create_date`)=MONTH(NEW.transaction_date_time);
SET V_RUNNING_NO = (V_RUNNING_NO +1);
SET V_DOCUMENT_NO = LPAD(V_RUNNING_NO, 6, 0);
SET V_DOCUMENT_NO = CONCAT(NEW.branch_code,'-',V_INVOICE_PREFIX,V_DATE_PREFIX,V_DOCUMENT_NO);
SET NEW.document_no = V_DOCUMENT_NO;
UPDATE `document_running_no`
SET `running_no` = `running_no` + 1
WHERE `id`=V_DOCUMENT_ID;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_log_credit_note_bonus_date` BEFORE UPDATE ON `credit_note` FOR EACH ROW BEGIN
DECLARE v_document_no VARCHAR(255) DEFAULT '';
IF (NEW.bonus_date <> OLD.bonus_date) THEN
SELECT `document_no` INTO v_document_no
FROM `service-counter`.`orders`
WHERE `id` = OLD.order_id;
INSERT INTO history_credit_note_bonus_date
(old_bonus_date,
new_bonus_date,
bonus_date_remark,
done_by,
order_id,
document_no,
order_document_no,
uuid,
create_date_time)
values (OLD.bonus_date,
NEW.bonus_date,
NEW.bonus_date_remark,
NEW.done_by,
OLD.id,
OLD.document_no,
v_document_no,
OLD.uuid,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `credit_note_taxation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `credit_note_taxation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`credit_note_uuid` varchar(50) NOT NULL DEFAULT '',
`tax_amount` decimal(12,2) DEFAULT '0.00',
`message_tag` varchar(255) DEFAULT '',
`percentage` decimal(10,2) DEFAULT '0.00',
`inclusive` varchar(5) DEFAULT 'N',
`done_by` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `deprecated_orders_details_product`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deprecated_orders_details_product` (
`id` bigint NOT NULL AUTO_INCREMENT,
`orders_details_variation_id` bigint NOT NULL,
`p_id` bigint NOT NULL,
`product_sub` varchar(45) DEFAULT NULL,
`product_code` varchar(45) DEFAULT NULL,
`product_name` json DEFAULT NULL,
`product_type` varchar(45) DEFAULT NULL,
`product_brand` varchar(45) DEFAULT NULL,
`product_category` varchar(45) DEFAULT NULL,
`product_component` varchar(45) DEFAULT NULL,
`product_sicategory` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `deprecated_orders_details_product_sku`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deprecated_orders_details_product_sku` (
`orders_details_sku_variation_id` bigint NOT NULL,
`orders_details_variation_id` bigint NOT NULL,
`qty` int NOT NULL DEFAULT '0',
`qty_foc` int NOT NULL DEFAULT '0',
`qty_left` int NOT NULL DEFAULT '0',
`qty_foc_left` int NOT NULL DEFAULT '0',
PRIMARY KEY (`orders_details_sku_variation_id`,`orders_details_variation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `deprecated_orders_details_sku`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deprecated_orders_details_sku` (
`id` bigint NOT NULL AUTO_INCREMENT,
`orders_details_sku_variation_id` bigint NOT NULL,
`sku_id` bigint NOT NULL,
`sku_sub` varchar(45) DEFAULT NULL,
`sku_code` varchar(45) DEFAULT NULL,
`sku_name` json DEFAULT NULL,
`sku_brand` varchar(45) DEFAULT NULL,
`sku_category` varchar(45) DEFAULT NULL,
`sku_mainitem` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `deprecated_orders_details_sku_variation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deprecated_orders_details_sku_variation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`sv_id` bigint NOT NULL,
`sv_prefix` varchar(255) DEFAULT NULL,
`sv_variant` varchar(45) DEFAULT NULL,
`sv_variant_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `deprecated_orders_details_variation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deprecated_orders_details_variation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`orders_details_id` bigint NOT NULL,
`v_id` bigint NOT NULL,
`v_prefix` varchar(255) DEFAULT NULL,
`v_ref_id` varchar(45) DEFAULT NULL,
`v_type` varchar(45) DEFAULT NULL,
`v_variant` varchar(45) DEFAULT NULL,
`v_variant_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `document_running_no`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `document_running_no` (
`id` bigint NOT NULL AUTO_INCREMENT,
`create_date` date DEFAULT NULL,
`branch_code` varchar(50) DEFAULT NULL,
`invoice_prefix` varchar(50) DEFAULT NULL,
`running_no` bigint DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`name` varchar(255) DEFAULT NULL,
`location` varchar(255) DEFAULT NULL,
`date_start` datetime DEFAULT NULL,
`date_end` datetime DEFAULT NULL,
`upload_floor_plan` text,
`upload_stage_activities` text,
`upload_lucky_draw` text,
`upload_taste_rewards` text,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_NAME` (`name`) /*!80000 INVISIBLE */,
KEY `IDX_DATE_RANGE` (`date_start`,`date_end`) /*!80000 INVISIBLE */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_attendance`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_attendance` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(20,0) NOT NULL,
`owner_uuid` decimal(20,0) NOT NULL,
`event_uuid` decimal(20,0) NOT NULL,
`action_date_time` datetime DEFAULT NULL,
`attendance_type` varchar(50) NOT NULL DEFAULT 'NA',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_OWNER_UUID` (`owner_uuid`),
KEY `IDX_EVENT_UUID` (`event_uuid`),
KEY `IDX_REPORT` (`event_uuid`,`action_date_time`,`owner_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_booth`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_booth` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`stockist_uuid` bigint NOT NULL,
`welcome_gift` varchar(5) NOT NULL DEFAULT 'Y',
`welcome_gift_daily_basis` varchar(5) DEFAULT 'Y',
`welcome_gift_max_per_user` int DEFAULT '0',
`welcome_gift_daily_cap` int NOT NULL DEFAULT '0',
`welcome_gift_event_cap` int NOT NULL DEFAULT '0',
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_EVENT_BOOTH` (`event_uuid`,`stockist_uuid`,`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_gift_with_purchase`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_gift_with_purchase` (
`id` bigint NOT NULL AUTO_INCREMENT,
`event_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`redeemed_count` int DEFAULT '1',
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_EVENT_MEMBER` (`event_uuid`,`member_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_lucky_draw_ticket`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_lucky_draw_ticket` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`receipt_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`member_code` varchar(255) NOT NULL,
`ticket_number` varchar(255) NOT NULL,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_EVENT` (`event_uuid`),
KEY `IDX_TICKET` (`ticket_number`),
KEY `IDX_RECEIPT` (`receipt_uuid`),
KEY `IDX_EVENT_MEMBER_UUID` (`event_uuid`,`member_uuid`,`enabled`),
KEY `IDX_EVENT_MEMBER` (`event_uuid`,`member_code`,`enabled`),
KEY `IDX_EVENT_RECEIPT` (`event_uuid`,`receipt_uuid`,`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_product`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_product` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(20,0) NOT NULL,
`event_uuid` decimal(20,0) NOT NULL,
`display_name` varchar(255) DEFAULT NULL,
`upload_path` text,
`cost_amount` decimal(14,2) NOT NULL,
`add_on_cost_label` varchar(255) DEFAULT NULL,
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_EVENT_AND_ENABLED` (`event_uuid`,`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_receipt`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_receipt` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`member_code` varchar(255) NOT NULL,
`upload_date_time` datetime DEFAULT NULL,
`upload_path` text,
`purchase_amount` decimal(14,2) DEFAULT '0.00',
`review_status` varchar(5) NOT NULL DEFAULT 'P',
`review_remarks` varchar(255) DEFAULT NULL,
`reviewed_by` varchar(255) DEFAULT NULL,
`reviewed_date_time` datetime DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_EVENT` (`event_uuid`),
KEY `IDX_EVENT_MEMBER` (`event_uuid`,`member_code`),
KEY `IDX_EVENT_MEMBER_UUID` (`event_uuid`,`member_uuid`),
KEY `IDX_EVENT_STATUS` (`event_uuid`,`review_status`),
KEY `IDX_EVENT_MEMBER_STATUS` (`event_uuid`,`member_code`,`review_status`),
KEY `IDX_EVENT_MEMBER_UUID_STATUS` (`event_uuid`,`member_uuid`,`review_status`),
KEY `IDX_MEMBER` (`member_uuid`),
KEY `IDX_MEMBER_STATUS` (`member_uuid`,`review_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_receipt_detail`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_receipt_detail` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(32,0) NOT NULL,
`event_uuid` decimal(32,0) DEFAULT '0',
`member_uuid` decimal(32,0) DEFAULT '0',
`event_receipt_uuid` decimal(32,0) NOT NULL DEFAULT '0',
`stockist_uuid` decimal(32,0) DEFAULT '0',
`stockist_name` varchar(250) DEFAULT NULL,
`amount` decimal(14,2) DEFAULT '0.00',
`enabled` varchar(5) NOT NULL DEFAULT 'Y',
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE_UUID` (`uuid`),
KEY `IDX_STOCKIST` (`stockist_uuid`,`enabled`) USING BTREE,
KEY `IDX_STOCKIST_NAME` (`stockist_name`,`enabled`) USING BTREE,
KEY `IDX_EVENT_UUID` (`event_receipt_uuid`,`enabled`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_redeem_code`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_redeem_code` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`event_uuid` bigint NOT NULL DEFAULT '0',
`stockist_uuid` bigint NOT NULL DEFAULT '0',
`member_uuid` bigint NOT NULL DEFAULT '0',
`redeem_code` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`redeem_status` varchar(5) NOT NULL DEFAULT 'Y',
`redeemed_date_time` datetime DEFAULT NULL,
`expiry_date_time` datetime DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
UNIQUE KEY `redeem_code_UNIQUE` (`redeem_code`),
KEY `IDX_EVENT_STOCKIST` (`event_uuid`,`stockist_uuid`,`redeem_status`),
KEY `IDX_MEMBER_CREATE` (`member_uuid`,`create_date_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_reward_plus`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_reward_plus` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(20,0) NOT NULL,
`owner_uuid` decimal(20,0) NOT NULL,
`event_uuid` decimal(20,0) NOT NULL,
`transaction_date_time` datetime DEFAULT NULL,
`total_amount` decimal(14,2) DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_OWNER_UUID` (`owner_uuid`),
KEY `IDX_EVENT_UUID` (`event_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event_reward_plus_detail`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `event_reward_plus_detail` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` decimal(20,0) NOT NULL,
`parent_uuid` decimal(20,0) NOT NULL,
`product_uuid` decimal(20,0) NOT NULL,
`product_json` text,
`quantity` int DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_PARENT_UUID` (`parent_uuid`),
KEY `IDX_PRODUCT_UUID` (`product_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_credit_note_bonus_date`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_credit_note_bonus_date` (
`id` int NOT NULL AUTO_INCREMENT,
`old_bonus_date` date DEFAULT NULL,
`new_bonus_date` date DEFAULT NULL,
`bonus_date_remark` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`order_id` varchar(45) DEFAULT NULL,
`document_no` varchar(255) DEFAULT NULL,
`order_document_no` varchar(255) DEFAULT NULL,
`uuid` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_order_bonus_date`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_order_bonus_date` (
`id` int NOT NULL AUTO_INCREMENT,
`old_bonus_date` date DEFAULT NULL,
`new_bonus_date` date DEFAULT NULL,
`bonus_date_remark` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`order_id` varchar(45) DEFAULT NULL,
`document_no` varchar(255) DEFAULT NULL,
`uuid` varchar(255) DEFAULT NULL,
`buyer` json DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_order_buyer`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_order_buyer` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint DEFAULT NULL,
`document_no` varchar(255) DEFAULT NULL,
`uuid` varchar(50) DEFAULT NULL,
`buyer_id` bigint DEFAULT NULL,
`buyer_code` varchar(255) DEFAULT NULL,
`buyer` json DEFAULT NULL,
`new_buyer_id` bigint DEFAULT NULL,
`new_buyer_code` varchar(255) DEFAULT NULL,
`new_buyer` json DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_order_document_no`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_order_document_no` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint DEFAULT NULL,
`uuid` varchar(50) DEFAULT NULL,
`document_no` varchar(255) DEFAULT NULL,
`new_document_no` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_order_sales_status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_order_sales_status` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint DEFAULT NULL,
`document_no` varchar(255) DEFAULT NULL,
`uuid` varchar(50) DEFAULT NULL,
`old_status` varchar(45) DEFAULT NULL,
`new_status` varchar(45) DEFAULT NULL,
`buyer_id` bigint DEFAULT NULL,
`buyer_code` varchar(255) DEFAULT NULL,
`buyer_name` varchar(255) DEFAULT NULL,
`status_remark` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_order_transaction_date_time`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_order_transaction_date_time` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint DEFAULT NULL,
`uuid` varchar(50) DEFAULT NULL,
`transaction_date_time` datetime DEFAULT NULL,
`new_transaction_date_time` datetime DEFAULT NULL,
`remarks` text,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `indonesia_invoice`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `indonesia_invoice` (
`date` varchar(45) DEFAULT NULL,
`invoice` varchar(45) NOT NULL,
`do_no` varchar(45) DEFAULT NULL,
`sub_district` varchar(45) DEFAULT NULL,
`city_code` varchar(45) DEFAULT NULL,
`total_volume` varchar(45) DEFAULT NULL,
`total_weight` varchar(45) DEFAULT NULL,
`rate` varchar(45) DEFAULT NULL,
`delivery_fees` varchar(45) DEFAULT NULL,
PRIMARY KEY (`invoice`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `main_cart`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `main_cart` (
`id` bigint NOT NULL AUTO_INCREMENT,
`member_id` varchar(45) NOT NULL,
`buyer_code` varchar(45) DEFAULT NULL,
`buyer_id` varchar(10) DEFAULT NULL,
`country_id` varchar(45) DEFAULT NULL,
`trxn_type` varchar(5) DEFAULT NULL,
`prv_no` varchar(100) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `member_id_UNIQUE` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `member_voucher`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `member_voucher` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`name` varchar(255) DEFAULT NULL,
`description` varchar(1000) DEFAULT NULL,
`currency_symbol` varchar(10) NOT NULL DEFAULT 'RM',
`upload_path` varchar(500) DEFAULT NULL,
`amount` double NOT NULL DEFAULT '0',
`redemption_limit` int DEFAULT NULL,
`effective_from` datetime DEFAULT NULL,
`effective_to` datetime DEFAULT NULL,
`active` varchar(1) NOT NULL DEFAULT 'Y',
`require_complete_profile` varchar(1) NOT NULL DEFAULT 'Y',
`create_by` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_member_voucher_uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `member_voucher_redemption`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `member_voucher_redemption` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` bigint NOT NULL,
`voucher_uuid` bigint NOT NULL,
`member_uuid` bigint NOT NULL,
`redeemed_date_time` datetime DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`channel` varchar(32) DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_member_voucher_redemption_uuid` (`uuid`),
UNIQUE KEY `uk_member_voucher_redemption_voucher_member` (`voucher_uuid`,`member_uuid`),
KEY `idx_member_voucher_redemption_member` (`member_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `orders`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders` (
`id` bigint NOT NULL AUTO_INCREMENT,
`emrm_counter_trxid` bigint DEFAULT '0',
`uuid` varchar(50) DEFAULT '',
`parent_order_uuid` varchar(50) DEFAULT NULL,
`transaction_date_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`bonus_date` date DEFAULT NULL,
`bonus_date_remark` varchar(255) DEFAULT NULL,
`location` varchar(5) DEFAULT NULL,
`country_code` varchar(10) DEFAULT NULL,
`branch_code` varchar(50) DEFAULT '',
`invoice_prefix` varchar(50) DEFAULT '',
`document_no` varchar(255) DEFAULT '',
`trx_type` varchar(10) DEFAULT '',
`payment_term` varchar(5) DEFAULT 'PF',
`buyer_id` bigint DEFAULT NULL,
`buyer_code` varchar(50) DEFAULT NULL,
`buyer_type` varchar(5) DEFAULT 'G',
`currency_symbol` varchar(20) DEFAULT '',
`currency_rate` decimal(12,5) DEFAULT '0.00000',
`total_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
`total_discount` decimal(12,2) NOT NULL DEFAULT '0.00',
`rounding_adjustment` decimal(12,2) DEFAULT '0.00',
`grand_total` decimal(12,2) DEFAULT '0.00',
`total_bv` decimal(12,2) NOT NULL DEFAULT '0.00',
`total_sv` decimal(12,2) NOT NULL DEFAULT '0.00',
`total_weight` decimal(12,2) NOT NULL DEFAULT '0.00',
`total_volume` decimal(12,2) NOT NULL DEFAULT '0.00',
`volume_divide_rate` int DEFAULT '0',
`weight_markup_rate` decimal(12,2) DEFAULT '0.00',
`volume_markup_rate` decimal(12,2) DEFAULT '0.00',
`shipping_cost` decimal(12,2) NOT NULL DEFAULT '0.00',
`status` varchar(5) DEFAULT 'P',
`status_remark` varchar(255) DEFAULT NULL,
`delivery_order_status` varchar(5) DEFAULT 'PE',
`tracking_no` varchar(255) DEFAULT NULL,
`stock_return` varchar(5) NOT NULL DEFAULT 'N',
`buyer` json DEFAULT NULL,
`payment_remark` text,
`remark` text,
`payment_reference` varchar(200) DEFAULT NULL,
`prv_no` varchar(100) DEFAULT NULL,
`invoice_header` text,
`invoice_footer` json DEFAULT NULL,
`orderscol` varchar(45) DEFAULT NULL,
`print_count` bigint DEFAULT '0',
`delivery_print_count` bigint DEFAULT '0',
`source_platform` varchar(5) NOT NULL DEFAULT 'BO',
`done_by` varchar(255) DEFAULT '',
`self_service_id` varchar(50) DEFAULT '',
`last_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`create_by` varchar(255) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`voided_flag` varchar(5) NOT NULL DEFAULT 'N',
`voided_reason` text,
`voided_by` varchar(255) DEFAULT '',
`voided_date_time` datetime DEFAULT NULL,
`delivery_option` tinyint DEFAULT '0',
`receiver` varchar(255) DEFAULT NULL,
`contact_no` varchar(45) DEFAULT NULL,
`delivery_geo_location_id` varchar(10) DEFAULT NULL,
`town` varchar(255) DEFAULT NULL,
`address_details` text,
`postcode` varchar(45) DEFAULT NULL,
`pickup_option` tinyint DEFAULT '0',
`pickup_point` varchar(45) DEFAULT NULL,
`pickup_point_location` varchar(45) DEFAULT NULL,
`stockist_deposit_balance` decimal(14,2) DEFAULT '0.00',
`stockist_sales_approval` varchar(5) DEFAULT 'N',
`stockist_sales_approved_by` varchar(255) DEFAULT '',
`stockist_sales_approval_date_time` datetime DEFAULT NULL,
`contain_birthday_treat_item` tinyint DEFAULT '0',
`locale` varchar(5) DEFAULT 'en_US',
`from_emrm` varchar(5) NOT NULL DEFAULT 'N',
`ref1` varchar(255) DEFAULT '',
`user_agent` text,
`contain_new_retention` tinyint DEFAULT '0',
`promotion_code` varchar(45) DEFAULT NULL,
`required_approval` varchar(5) NOT NULL DEFAULT 'N',
`pickup_point_osn` json DEFAULT NULL,
`pickup_date` date DEFAULT NULL,
`pickup_slot` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
UNIQUE KEY `document_no_UNIQUE` (`document_no`),
KEY `buyer_code_index` (`buyer_code`),
KEY `MSRpt_TrxD_IDX` (`transaction_date_time`,`status`,`trx_type`),
KEY `MSSRpt_BnsD_IDX` (`bonus_date`,`status`,`trx_type`),
KEY `IDX_BNSDATE` (`bonus_date`),
KEY `IDX_BUYERCODE_BNSDATE` (`buyer_code`,`bonus_date`),
KEY `IDX_STATUS_TRXDATE` (`status`,`transaction_date_time`),
KEY `IDX_BD_SP_STAT` (`bonus_date`,`status`,`source_platform`),
KEY `IDX_STATUS_DOCNO` (`status`,`document_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_log_bonus_date` BEFORE UPDATE ON `orders` FOR EACH ROW BEGIN
IF (NEW.bonus_date <> OLD.bonus_date) THEN
INSERT INTO history_order_bonus_date
(old_bonus_date,
new_bonus_date,
bonus_date_remark,
done_by,
order_id,
document_no,
uuid,
buyer,
create_date_time)
values (OLD.bonus_date,
NEW.bonus_date,
NEW.bonus_date_remark,
NEW.done_by,
OLD.id,
OLD.document_no,
OLD.uuid,
OLD.buyer,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_log_sales_status` BEFORE UPDATE ON `orders` FOR EACH ROW BEGIN
DECLARE v_member_id BIGINT DEFAULT '0';
DECLARE v_member_code VARCHAR(255) DEFAULT '';
DECLARE v_member_name VARCHAR(255) DEFAULT '';
IF (NEW.status <> OLD.status) THEN
SELECT `id`,`member_code`,`name`
INTO v_member_id, v_member_code, v_member_name
FROM `service-member`.`member`
WHERE `member_code` = OLD.buyer_code;
INSERT INTO history_order_sales_status
(order_id,
document_no,
uuid,
old_status,
new_status,
buyer_id,
buyer_code,
buyer_name,
status_remark,
done_by,
create_date_time)
values (OLD.id,
OLD.document_no,
OLD.uuid,
OLD.status,
NEW.status,
v_member_id,
v_member_code,
v_member_name,
NEW.status_remark,
NEW.done_by,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_buyer` BEFORE UPDATE ON `orders` FOR EACH ROW BEGIN
DECLARE v_member_id BIGINT DEFAULT '0';
DECLARE v_member_code VARCHAR(255) DEFAULT '';
DECLARE v_member_name VARCHAR(255) DEFAULT '';
IF (NEW.buyer_id <> OLD.buyer_id) THEN
INSERT INTO history_order_buyer
(`order_id`,
`document_no`,
`uuid`,
`buyer_id`,
`buyer_code`,
`buyer`,
`new_buyer_id`,
`new_buyer_code`,
`new_buyer`,
`done_by`,
`create_date_time`)
values (NEW.id,
NEW.document_no,
NEW.uuid,
OLD.buyer_id,
OLD.buyer_code,
OLD.buyer,
NEW.buyer_id,
NEW.buyer_code,
NEW.buyer,
NEW.done_by,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_protect_document_no` BEFORE UPDATE ON `orders` FOR EACH ROW BEGIN
-- DETECT document_no CHANGE
IF (NEW.document_no <> OLD.document_no) THEN
-- IF document_no != uuid means document_no already generated, reset NEW to OLD
IF (OLD.document_no <> OLD.uuid) THEN
SET NEW.document_no=OLD.document_no;
END IF;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `generate_document_no` BEFORE UPDATE ON `orders` FOR EACH ROW BEGIN
DECLARE V_DOCUMENT_ID BIGINT DEFAULT 0;
DECLARE V_RUNNING_NO BIGINT DEFAULT 0;
DECLARE V_TRANSACTION_DATE DATE;
DECLARE V_DOCUMENT_NO VARCHAR(50);
DECLARE V_DATE_PREFIX VARCHAR(50);
IF (OLD.status='P' AND NEW.status='Y' ) THEN
IF(OLD.document_no IS NULL OR OLD.document_no='' OR OLD.document_no=OLD.uuid) THEN
IF NOT EXISTS (
SELECT (1) FROM `document_running_no` doc
WHERE doc.`invoice_prefix` = NEW.invoice_prefix
) THEN
INSERT INTO `document_running_no`
(`create_date`,`branch_code`, `invoice_prefix`, `running_no`)
VALUES
(DATE(NEW.transaction_date_time),NEW.branch_code, NEW.invoice_prefix, 0);
END IF;
SELECT `id`,`running_no`,DATE_FORMAT(`create_date`, '%y%m')
into V_DOCUMENT_ID, V_RUNNING_NO, V_DATE_PREFIX
from `document_running_no` doc
WHERE doc.`invoice_prefix` = NEW.invoice_prefix;
SET V_RUNNING_NO = (V_RUNNING_NO +1);
SET V_DOCUMENT_NO = LPAD(V_RUNNING_NO, 8, 0);
SET V_DOCUMENT_NO = CONCAT(NEW.invoice_prefix,V_DOCUMENT_NO);
SET NEW.document_no = V_DOCUMENT_NO;
UPDATE `document_running_no`
SET `running_no` = `running_no` + 1
WHERE `id`=V_DOCUMENT_ID;
END IF;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_log_document_no` AFTER UPDATE ON `orders` FOR EACH ROW BEGIN
IF (NEW.document_no <> OLD.document_no) THEN
INSERT INTO history_order_document_no
( `order_id`,
`uuid`,
`document_no`,
`new_document_no`,
`create_date_time`)
values (NEW.id,
NEW.uuid,
OLD.document_no,
NEW.document_no,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `orders_details`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders_details` (
`id` bigint NOT NULL AUTO_INCREMENT,
`emrm_counter_details_id` bigint DEFAULT '0',
`order_uuid` varchar(50) NOT NULL DEFAULT '',
`variation` json DEFAULT NULL,
`qty` int NOT NULL DEFAULT '0',
`virtual_variation_id` bigint GENERATED ALWAYS AS (json_unquote(json_extract(`variation`,_utf8mb4'$.id'))) STORED,
`virtual_product_code` varchar(200) GENERATED ALWAYS AS (json_unquote(json_extract(`variation`,_utf8mb4'$.product.productCode'))) STORED,
`virtual_product_name` text GENERATED ALWAYS AS (json_unquote(json_extract(`variation`,_utf8mb4'$.product.productName'))) STORED,
`virtual_sku_code` text GENERATED ALWAYS AS (json_extract(json_unquote(json_extract(`variation`,_utf8mb4'$.productSku')),_utf8mb4'$[*].skuVariation.sku.skuCode')) STORED,
`virtual_sku_brand` text GENERATED ALWAYS AS (json_extract(json_unquote(json_extract(`variation`,_utf8mb4'$.productSku')),_utf8mb4'$[*].skuVariation.sku.skuBrand')) STORED,
`virtual_sku_contains_pants` int GENERATED ALWAYS AS (json_contains(`virtual_sku_brand`,_utf8mb4'"6"')) STORED,
PRIMARY KEY (`id`),
KEY `order_uuid_index` (`order_uuid`) USING BTREE,
KEY `IDX_VARIATION_ID` (`virtual_variation_id`),
KEY `IDX_UUID_VARIATION_ID` (`order_uuid`,`virtual_variation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `orders_details_pricing`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders_details_pricing` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_details_id` bigint NOT NULL,
`p_pricing_id` bigint DEFAULT '0',
`p_variation_id` varchar(45) DEFAULT NULL,
`p_price_type` varchar(45) DEFAULT NULL,
`p_country` varchar(45) DEFAULT NULL,
`p_region` varchar(45) DEFAULT NULL,
`p_price` double(14,2) DEFAULT NULL,
`p_status` char(1) DEFAULT NULL,
`p_done_by` varchar(100) DEFAULT NULL,
`p_update_by` varchar(100) DEFAULT NULL,
`p_bv` double(14,2) DEFAULT NULL,
`p_sv` double(14,2) DEFAULT NULL,
`p_create_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `order_details_id_index` (`order_details_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `orders_payments`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders_payments` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_uuid` varchar(50) NOT NULL DEFAULT '',
`buyer_code` varchar(50) DEFAULT '',
`total_amount` decimal(12,2) DEFAULT '0.00',
`payment_method_id` bigint DEFAULT '0',
`message_tag` varchar(200) DEFAULT 'DEFAULT',
`payment_type` varchar(20) NOT NULL DEFAULT 'PC',
`status` varchar(5) NOT NULL DEFAULT 'P',
`message` text,
`remarks` varchar(255) DEFAULT NULL,
`ref1` varchar(255) DEFAULT NULL,
`ref2` varchar(255) DEFAULT NULL,
`ref3` varchar(255) DEFAULT NULL,
`ref4` varchar(255) DEFAULT NULL,
`ref5` varchar(255) DEFAULT NULL,
`done_by` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_uuid_index` (`order_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `orders_taxation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders_taxation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_uuid` varchar(50) NOT NULL DEFAULT '',
`tax_amount` decimal(12,2) DEFAULT '0.00',
`message_tag` varchar(255) DEFAULT '',
`percentage` decimal(10,2) DEFAULT '0.00',
`inclusive` varchar(5) DEFAULT 'N',
`done_by` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_UUID` (`order_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `promotion_code`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `promotion_code` (
`id` int NOT NULL AUTO_INCREMENT,
`code` varchar(45) DEFAULT NULL,
`limited` int DEFAULT NULL,
`for_item` tinyint DEFAULT NULL,
`product_id` int DEFAULT NULL,
`quantity_required` int DEFAULT NULL,
`free_product_id` int DEFAULT NULL,
`free_quantity` int DEFAULT NULL,
`active` char(3) DEFAULT NULL,
`effective_from` datetime DEFAULT NULL,
`effective_to` datetime DEFAULT NULL,
`create_by` varchar(45) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `promotion_code_use`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `promotion_code_use` (
`id` int NOT NULL AUTO_INCREMENT,
`promotion_code` varchar(45) DEFAULT NULL,
`member_id` int DEFAULT NULL,
`limited` int DEFAULT NULL,
`used` int DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE_MEMBER_CODE` (`member_id`,`promotion_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `snowflake_state`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `snowflake_state` (
`node_id` tinyint unsigned NOT NULL,
`last_timestamp_ms` bigint unsigned NOT NULL DEFAULT '0',
`sequence` smallint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`node_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping routines for database 'service-counter'
--
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `gen_snowflake_id`(
_node_id TINYINT UNSIGNED
) RETURNS bigint unsigned
BEGIN
DECLARE epoch_ms BIGINT UNSIGNED;
DECLARE current_ms BIGINT UNSIGNED;
DECLARE last_ms BIGINT UNSIGNED;
DECLARE seq SMALLINT UNSIGNED;
DECLARE generated_id BIGINT UNSIGNED;
SET epoch_ms = 1420070400000;
SELECT GET_LOCK(CONCAT('snowflake_lock_', _node_id), 5) INTO @lock_result;
IF @lock_result <> 1 THEN
RETURN NULL;
END IF;
SELECT `last_timestamp_ms`, `sequence` INTO last_ms, seq
FROM `snowflake_state`
WHERE `node_id` = _node_id;
SET current_ms = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000);
IF current_ms > last_ms THEN
SET seq = 0;
ELSE
SET seq = seq + 1;
WHILE seq > 4095 DO
SET current_ms = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000);
IF current_ms > last_ms THEN
SET seq = 0;
END IF;
DO SLEEP(0.001);
END WHILE;
END IF;
UPDATE `snowflake_state`
SET `last_timestamp_ms` = current_ms, `sequence` = seq
WHERE `node_id` = _node_id;
SET generated_id = (current_ms - epoch_ms) << 22;
SET generated_id = generated_id | (_node_id << 12);
SET generated_id = generated_id | seq;
SELECT RELEASE_LOCK(CONCAT('snowflake_lock_', _node_id)) INTO @unlock_result;
RETURN generated_id;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!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 */;
-- Dump completed on 2026-11-26 16:13:06
USE `service-member`;
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: service-member
-- ------------------------------------------------------
-- Server version 8.4.8
/*!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 */;
/*!50503 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 */;
--
-- Temporary view structure for view `TEMP_VIEW_COLUMNS`
--
SET @saved_cs_client = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `TEMP_VIEW_COLUMNS` AS SELECT
1 AS `COLUMN_NAME`*/;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `archived_augexpo2024_member`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `archived_augexpo2024_member` (
`id` bigint NOT NULL DEFAULT '0',
`uuid` varchar(100) NOT NULL,
`migrated_from` bigint DEFAULT '0',
`migrated_date_time` datetime DEFAULT NULL,
`migrated_ewallet` decimal(14,4) DEFAULT '0.0000',
`migrated_car_fund` decimal(12,2) DEFAULT '0.00',
`migrated_house_fund` decimal(12,2) DEFAULT '0.00',
`migrated_by` varchar(100) DEFAULT NULL,
`prefix` varchar(20) DEFAULT '',
`nationality` varchar(20) DEFAULT '',
`member_code` varchar(20) DEFAULT '',
`generation` int NOT NULL DEFAULT '1',
`member_rank` varchar(20) DEFAULT 'NA',
`rank_council` varchar(20) DEFAULT 'NA',
`highest_rank` varchar(20) DEFAULT 'NA',
`identity_type` varchar(5) DEFAULT 'NIC',
`identity_no` varchar(100) DEFAULT '',
`passport_no` varchar(100) DEFAULT '',
`email` varchar(255) DEFAULT NULL,
`phone_no_prefix` varchar(50) DEFAULT '',
`phone_no` varchar(100) DEFAULT '',
`phone_no_combined` varchar(200) DEFAULT NULL,
`member_type` varchar(3) DEFAULT 'N',
`date_join` date DEFAULT NULL,
`date_expiry` date DEFAULT NULL,
`dob` date DEFAULT NULL,
`salutation_id` bigint DEFAULT '0',
`name` varchar(255) DEFAULT NULL,
`other_name` varchar(255) DEFAULT NULL,
`surname` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`nickname` varchar(255) DEFAULT '',
`sponsor_id` varchar(45) DEFAULT NULL,
`status` varchar(3) NOT NULL DEFAULT 'P',
`status_sub` varchar(15) NOT NULL DEFAULT 'NA',
`kyc_flag` varchar(5) NOT NULL DEFAULT 'N',
`kyc_manual_flag` varchar(5) NOT NULL DEFAULT 'N',
`gender` varchar(3) DEFAULT 'M',
`race` varchar(3) DEFAULT 'O',
`marrital_status` varchar(3) DEFAULT 'S',
`local_tax_resident` varchar(5) NOT NULL DEFAULT 'N',
`withholding_tax` varchar(5) NOT NULL DEFAULT 'N',
`withholding_tax_number` varchar(50) DEFAULT '',
`income_tax_no` varchar(255) DEFAULT '',
`address_location` varchar(50) DEFAULT '',
`town` varchar(255) DEFAULT '',
`address_details` varchar(250) DEFAULT '',
`post_code` varchar(20) DEFAULT '',
`spouse_name` varchar(255) DEFAULT '',
`spouse_identity_type` varchar(3) DEFAULT 'NIC',
`spouse_identity_no` varchar(50) DEFAULT '',
`spouse_passport_no` varchar(50) DEFAULT '',
`spouse_phone_no_prefix` varchar(50) DEFAULT '',
`spouse_phone_no` varchar(100) DEFAULT '',
`spouse_phone_no_combined` varchar(200) DEFAULT NULL,
`bank_id` bigint DEFAULT '0',
`payee_name` varchar(255) DEFAULT '',
`payee_identity_type` varchar(3) DEFAULT 'NIC',
`payee_identity_no` varchar(50) DEFAULT '',
`bank_account_no` varchar(100) DEFAULT '',
`is_mp` varchar(5) DEFAULT 'N',
`mp_phone_no` varchar(50) DEFAULT '',
`mp_identity_no` varchar(50) DEFAULT '',
`mp_prepaid_card` varchar(5) DEFAULT 'N',
`mp_prepaid_card_no` varchar(50) DEFAULT '',
`mp_prepaid_card_expiry_month` varchar(5) DEFAULT '',
`mp_prepaid_card_expiry_year` varchar(5) DEFAULT '',
`beneficiary_name` varchar(255) DEFAULT '',
`beneficiary_identity_type` varchar(3) DEFAULT 'NIC',
`beneficiary_identity_no` varchar(50) DEFAULT '',
`beneficiary_relation` varchar(50) DEFAULT '',
`beneficiary_phone_no_prefix` varchar(50) DEFAULT '',
`beneficiary_phone_no` varchar(100) DEFAULT '',
`remarks` varchar(255) DEFAULT '',
`device_model` varchar(45) DEFAULT NULL,
`app_version` varchar(45) DEFAULT NULL,
`preferred_language` json DEFAULT NULL,
`agree_randr` varchar(1) NOT NULL DEFAULT 'N',
`agree_pdpa` varchar(1) NOT NULL DEFAULT 'N',
`create_by` varchar(200) DEFAULT NULL,
`create_date` datetime NOT NULL,
`done_by` varchar(200) NOT NULL,
`status_remark` varchar(200) DEFAULT NULL,
`email_emrm` varchar(255) DEFAULT NULL,
`phone_no_emrm` varchar(255) DEFAULT NULL,
`address_emrm` text,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`last_purchase_bd_treat_date` date DEFAULT NULL,
`from_emrm` varchar(5) NOT NULL DEFAULT 'N',
`emrm_profile_update` varchar(5) NOT NULL DEFAULT 'N',
`last_purchase_new_retention_date` date DEFAULT NULL,
`npwp_id` bigint DEFAULT NULL,
`npwp_flag` varchar(5) DEFAULT 'NA',
`reg_rewards` varchar(5) NOT NULL DEFAULT 'N',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `audit_trail_member`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `audit_trail_member` (
`id` bigint NOT NULL AUTO_INCREMENT,
`revision_timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`last_done` varchar(200) DEFAULT NULL,
`old_id` bigint DEFAULT NULL,
`new_id` bigint DEFAULT NULL,
`uuid` varchar(100) DEFAULT NULL,
`new_uuid` varchar(100) DEFAULT NULL,
`migrated_from` bigint DEFAULT '0',
`new_migrated_from` bigint DEFAULT '0',
`migrated_date_time` datetime DEFAULT NULL,
`new_migrated_date_time` datetime DEFAULT NULL,
`migrated_ewallet` decimal(14,4) DEFAULT '0.0000',
`new_migrated_ewallet` decimal(14,4) DEFAULT '0.0000',
`migrated_car_fund` decimal(12,2) DEFAULT '0.00',
`new_migrated_car_fund` decimal(12,2) DEFAULT '0.00',
`migrated_house_fund` decimal(12,2) DEFAULT '0.00',
`new_migrated_house_fund` decimal(12,2) DEFAULT '0.00',
`migrated_by` varchar(100) DEFAULT NULL,
`new_migrated_by` varchar(100) DEFAULT NULL,
`prefix` varchar(20) DEFAULT '',
`new_prefix` varchar(20) DEFAULT '',
`nationality` varchar(20) DEFAULT '',
`new_nationality` varchar(20) DEFAULT '',
`member_code` varchar(20) DEFAULT '',
`new_member_code` varchar(20) DEFAULT '',
`generation` int NOT NULL DEFAULT '1',
`new_generation` int NOT NULL DEFAULT '1',
`member_rank` varchar(20) DEFAULT '',
`new_member_rank` varchar(20) DEFAULT '',
`rank_council` varchar(20) DEFAULT '',
`new_rank_council` varchar(20) DEFAULT '',
`highest_rank` varchar(20) DEFAULT '',
`new_highest_rank` varchar(20) DEFAULT '',
`identity_type` varchar(5) DEFAULT 'NIC',
`new_identity_type` varchar(5) DEFAULT 'NIC',
`identity_no` varchar(100) DEFAULT '',
`new_identity_no` varchar(100) DEFAULT '',
`passport_no` varchar(100) DEFAULT '',
`new_passport_no` varchar(100) DEFAULT '',
`email` varchar(255) DEFAULT NULL,
`new_email` varchar(255) DEFAULT NULL,
`phone_no_prefix` varchar(50) DEFAULT '',
`new_phone_no_prefix` varchar(50) DEFAULT '',
`phone_no` varchar(100) DEFAULT 'N',
`new_phone_no` varchar(100) DEFAULT 'N',
`phone_no_combined` varchar(200) DEFAULT NULL,
`new_phone_no_combined` varchar(200) DEFAULT NULL,
`member_type` varchar(3) DEFAULT 'N',
`new_member_type` varchar(3) DEFAULT 'N',
`date_join` date DEFAULT NULL,
`new_date_join` date DEFAULT NULL,
`date_expiry` date DEFAULT NULL,
`new_date_expiry` date DEFAULT NULL,
`dob` date DEFAULT NULL,
`new_dob` date DEFAULT NULL,
`salutation_id` bigint DEFAULT '0',
`new_salutation_id` bigint DEFAULT '0',
`name` varchar(255) DEFAULT NULL,
`new_name` varchar(255) DEFAULT NULL,
`other_name` varchar(255) DEFAULT NULL,
`new_other_name` varchar(255) DEFAULT NULL,
`surname` varchar(255) DEFAULT NULL,
`new_surname` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`new_username` varchar(255) DEFAULT NULL,
`nickname` varchar(255) DEFAULT '',
`new_nickname` varchar(255) DEFAULT '',
`sponsor_id` varchar(45) DEFAULT NULL,
`new_sponsor_id` varchar(45) DEFAULT NULL,
`status` varchar(3) NOT NULL DEFAULT 'P',
`new_status` varchar(3) NOT NULL DEFAULT 'P',
`status_sub` varchar(15) NOT NULL DEFAULT 'NA',
`new_status_sub` varchar(15) NOT NULL DEFAULT 'NA',
`kyc_flag` varchar(5) NOT NULL DEFAULT 'N',
`new_kyc_flag` varchar(5) NOT NULL DEFAULT 'N',
`kyc_manual_flag` varchar(5) NOT NULL DEFAULT 'N',
`new_kyc_manual_flag` varchar(5) NOT NULL DEFAULT 'N',
`gender` varchar(3) DEFAULT 'M',
`new_gender` varchar(3) DEFAULT 'M',
`race` varchar(3) DEFAULT 'O',
`new_race` varchar(3) DEFAULT 'O',
`marrital_status` varchar(3) DEFAULT 'S',
`new_marrital_status` varchar(3) DEFAULT 'S',
`local_tax_resident` varchar(5) NOT NULL DEFAULT 'N',
`new_local_tax_resident` varchar(5) NOT NULL DEFAULT 'N',
`withholding_tax` varchar(5) NOT NULL DEFAULT 'N',
`new_withholding_tax` varchar(5) NOT NULL DEFAULT 'N',
`withholding_tax_number` varchar(50) DEFAULT '',
`new_withholding_tax_number` varchar(50) DEFAULT '',
`income_tax_no` varchar(255) DEFAULT '',
`new_income_tax_no` varchar(255) DEFAULT '',
`address_location` varchar(50) DEFAULT '',
`new_address_location` varchar(50) DEFAULT '',
`address_details` varchar(250) DEFAULT '',
`new_address_details` varchar(250) DEFAULT '',
`post_code` varchar(20) DEFAULT '',
`new_post_code` varchar(20) DEFAULT '',
`spouse_name` varchar(255) DEFAULT '',
`new_spouse_name` varchar(255) DEFAULT '',
`spouse_identity_type` varchar(3) DEFAULT 'NIC',
`new_spouse_identity_type` varchar(3) DEFAULT 'NIC',
`spouse_identity_no` varchar(50) DEFAULT '',
`new_spouse_identity_no` varchar(50) DEFAULT '',
`spouse_passport_no` varchar(50) DEFAULT '',
`new_spouse_passport_no` varchar(50) DEFAULT '',
`spouse_phone_no_prefix` varchar(50) DEFAULT '',
`new_spouse_phone_no_prefix` varchar(50) DEFAULT '',
`spouse_phone_no` varchar(100) DEFAULT '',
`new_spouse_phone_no` varchar(100) DEFAULT '',
`spouse_phone_no_combined` varchar(200) DEFAULT NULL,
`new_spouse_phone_no_combined` varchar(200) DEFAULT NULL,
`bank_id` bigint DEFAULT '0',
`new_bank_id` bigint DEFAULT '0',
`payee_name` varchar(255) DEFAULT '',
`new_payee_name` varchar(255) DEFAULT '',
`payee_identity_type` varchar(3) DEFAULT 'NIC',
`new_payee_identity_type` varchar(3) DEFAULT 'NIC',
`payee_identity_no` varchar(50) DEFAULT '',
`new_payee_identity_no` varchar(50) DEFAULT '',
`bank_account_no` varchar(100) DEFAULT '',
`is_mp` varchar(5) DEFAULT 'N',
`new_is_mp` varchar(5) DEFAULT 'N',
`mp_phone_no` varchar(50) DEFAULT '',
`new_mp_phone_no` varchar(50) DEFAULT '',
`mp_identity_no` varchar(50) DEFAULT '',
`new_mp_identity_no` varchar(50) DEFAULT '',
`mp_prepaid_card` varchar(5) DEFAULT 'N',
`new_mp_prepaid_card` varchar(5) DEFAULT 'N',
`mp_prepaid_card_no` varchar(50) DEFAULT '',
`new_mp_prepaid_card_no` varchar(50) DEFAULT '',
`mp_prepaid_card_expiry_month` varchar(5) DEFAULT '',
`new_mp_prepaid_card_expiry_month` varchar(5) DEFAULT '',
`mp_prepaid_card_expiry_year` varchar(5) DEFAULT '',
`new_mp_prepaid_card_expiry_year` varchar(5) DEFAULT '',
`new_bank_account_no` varchar(100) DEFAULT '',
`beneficiary_name` varchar(255) DEFAULT '',
`new_beneficiary_name` varchar(255) DEFAULT '',
`beneficiary_identity_type` varchar(3) DEFAULT 'NIC',
`new_beneficiary_identity_type` varchar(3) DEFAULT 'NIC',
`beneficiary_identity_no` varchar(50) DEFAULT '',
`new_beneficiary_identity_no` varchar(50) DEFAULT '',
`beneficiary_relation` varchar(50) DEFAULT '',
`new_beneficiary_relation` varchar(50) DEFAULT '',
`beneficiary_phone_no_prefix` varchar(50) DEFAULT '',
`new_beneficiary_phone_no_prefix` varchar(50) DEFAULT '',
`beneficiary_phone_no` varchar(50) DEFAULT '',
`new_beneficiary_phone_no` varchar(50) DEFAULT '',
`remarks` varchar(255) DEFAULT '',
`new_remarks` varchar(255) DEFAULT '',
`device_model` varchar(45) DEFAULT NULL,
`new_device_model` varchar(45) DEFAULT NULL,
`app_version` varchar(45) DEFAULT NULL,
`new_app_version` varchar(45) DEFAULT NULL,
`agree_randr` varchar(1) NOT NULL DEFAULT 'N',
`new_agree_randr` varchar(1) NOT NULL DEFAULT 'N',
`agree_pdpa` varchar(1) NOT NULL DEFAULT 'N',
`new_agree_pdpa` varchar(1) NOT NULL DEFAULT 'N',
`create_by` varchar(200) DEFAULT NULL,
`new_create_by` varchar(200) DEFAULT NULL,
`create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`new_create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`done_by` varchar(200) NOT NULL,
`status_remark` varchar(200) DEFAULT NULL,
`new_status_remark` varchar(200) DEFAULT NULL,
`new_done_by` varchar(200) NOT NULL,
`email_emrm` varchar(200) DEFAULT NULL,
`new_email_emrm` varchar(200) DEFAULT NULL,
`phone_no_emrm` varchar(200) DEFAULT NULL,
`new_phone_no_emrm` varchar(200) DEFAULT NULL,
`address_emrm` text,
`new_address_emrm` text,
`from_emrm` varchar(5) DEFAULT 'N',
`new_from_emrm` varchar(5) DEFAULT 'N',
`emrm_profile_update` varchar(5) DEFAULT 'N',
`new_emrm_profile_update` varchar(5) DEFAULT 'N',
`preferred_language` json DEFAULT NULL,
`new_preferred_language` json DEFAULT NULL,
`last_purchase_bd_treat_date` date DEFAULT NULL,
`new_last_purchase_bd_treat_date` date DEFAULT NULL,
`last_purchase_new_retention_date` date DEFAULT NULL,
`new_last_purchase_new_retention_date` date DEFAULT NULL,
`npwp_id` bigint DEFAULT NULL,
`new_npwp_id` bigint DEFAULT NULL,
`npwp_flag` varchar(5) DEFAULT NULL,
`new_npwp_flag` varchar(5) DEFAULT NULL,
`reg_rewards` varchar(5) NOT NULL DEFAULT 'N',
`new_reg_rewards` varchar(5) NOT NULL DEFAULT 'N',
`town` varchar(255) DEFAULT NULL,
`new_town` varchar(255) DEFAULT NULL,
`profile_gift` varchar(5) NOT NULL DEFAULT 'N',
`new_profile_gift` varchar(5) NOT NULL DEFAULT 'N',
`profile_gift_date_time` datetime DEFAULT NULL,
`new_profile_gift_date_time` datetime DEFAULT NULL,
`profile_gift_by` varchar(255) DEFAULT NULL,
`new_profile_gift_by` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_MEMBER_ID` (`old_id`),
KEY `IDX_MEMBER_CODE` (`new_member_code`),
KEY `IDX_TIMESTAMP` (`revision_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bank`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bank` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL,
`branch_code` varchar(20) DEFAULT '',
`swift_code` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`message_tag` varchar(255) DEFAULT 'DEFAULT',
`bankid` varchar(255) DEFAULT NULL,
`bnm_code` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `batch_transfer_member`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `batch_transfer_member` (
`id` bigint NOT NULL AUTO_INCREMENT,
`batch_id` varchar(100) DEFAULT NULL,
`trxn_date` date DEFAULT NULL,
`trxn_time` time DEFAULT NULL,
`reason_code` varchar(45) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`status` varchar(5) DEFAULT NULL,
`createby` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `batch_transfer_member_details`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `batch_transfer_member_details` (
`id` bigint NOT NULL AUTO_INCREMENT,
`batch_id` varchar(5) DEFAULT NULL,
`member_code` varchar(100) DEFAULT NULL,
`new_member_code` varchar(100) DEFAULT '',
`target_prefix` varchar(10) DEFAULT NULL,
`status` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_SEARCH` (`member_code`,`new_member_code`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `customer`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `customer` (
`id` bigint NOT NULL AUTO_INCREMENT,
`prefix` varchar(20) DEFAULT '',
`uuid` varchar(255) NOT NULL,
`customer_code` varchar(45) DEFAULT '',
`username` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`phone_no_prefix` varchar(50) DEFAULT '',
`phone_no` varchar(100) DEFAULT '',
`phone_no_combined` varchar(200) GENERATED ALWAYS AS (concat(trim(`phone_no_prefix`),trim(`phone_no`))) STORED,
`email` varchar(255) DEFAULT NULL,
`dob` date DEFAULT NULL,
`address_location` varchar(50) DEFAULT '',
`address_details` varchar(250) DEFAULT '',
`post_code` varchar(20) DEFAULT '',
`member_type` varchar(3) DEFAULT 'PC',
`status` varchar(3) NOT NULL DEFAULT 'P',
`sponsor_id` varchar(45) DEFAULT NULL,
`date_join` date DEFAULT NULL,
`create_by` varchar(200) DEFAULT NULL,
`create_date` datetime NOT NULL,
`done_by` varchar(200) NOT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE_UUID` (`uuid`),
UNIQUE KEY `username_UNIQUE` (`username`),
KEY `IDX_DATE_JOIN` (`date_join`),
KEY `IDX_SPONSOR` (`sponsor_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `generate_customer_code` BEFORE INSERT ON `customer` FOR EACH ROW BEGIN
SET NEW.customer_code=func__generate_customer_code(NEW.id);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `history_member_bank_details`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_member_bank_details` (
`id` bigint NOT NULL AUTO_INCREMENT,
`member_id` bigint DEFAULT NULL,
`member_code` varchar(20) DEFAULT '',
`member_name` varchar(255) DEFAULT '',
`old_bank_id` bigint DEFAULT '0',
`new_bank_id` bigint DEFAULT '0',
`old_payee_name` varchar(255) DEFAULT '',
`new_payee_name` varchar(255) DEFAULT '',
`old_payee_identity_type` varchar(3) DEFAULT 'NIC',
`new_payee_identity_type` varchar(3) DEFAULT 'NIC',
`old_payee_identity_no` varchar(50) DEFAULT '',
`new_payee_identity_no` varchar(50) DEFAULT '',
`old_bank_account_no` varchar(255) DEFAULT '',
`new_bank_account_no` varchar(255) DEFAULT '',
`old_is_mp` varchar(5) DEFAULT 'N',
`new_is_mp` varchar(5) DEFAULT 'N',
`old_mp_phone_no` varchar(50) DEFAULT '',
`new_mp_phone_no` varchar(50) DEFAULT '',
`old_mp_identity_no` varchar(50) DEFAULT '',
`new_mp_identity_no` varchar(50) DEFAULT '',
`old_mp_prepaid_card` varchar(5) DEFAULT 'N',
`new_mp_prepaid_card` varchar(5) DEFAULT 'N',
`old_mp_prepaid_card_no` varchar(50) DEFAULT '',
`new_mp_prepaid_card_no` varchar(50) DEFAULT '',
`old_mp_prepaid_card_expiry_month` varchar(5) DEFAULT '',
`new_mp_prepaid_card_expiry_month` varchar(5) DEFAULT '',
`old_mp_prepaid_card_expiry_year` varchar(5) DEFAULT '',
`new_mp_prepaid_card_expiry_year` varchar(5) DEFAULT '',
`done_by` varchar(200) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history_member_status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history_member_status` (
`id` bigint NOT NULL AUTO_INCREMENT,
`member_id` varchar(255) DEFAULT NULL,
`member_code` varchar(255) DEFAULT NULL,
`member_name` varchar(255) DEFAULT NULL,
`uuid` varchar(50) DEFAULT NULL,
`join_date` date DEFAULT NULL,
`old_status` varchar(45) NOT NULL DEFAULT 'P',
`new_status` varchar(45) NOT NULL DEFAULT 'P',
`old_status_sub` varchar(45) NOT NULL DEFAULT 'NA',
`new_status_sub` varchar(45) NOT NULL DEFAULT 'NA',
`status_remark` varchar(255) DEFAULT NULL,
`done_by` varchar(255) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `marrital_status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `marrital_status` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
`message_tag` varchar(255) DEFAULT '',
`spouse_required` varchar(5) DEFAULT 'N',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_MarritalStatusCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `member`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `member` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` varchar(100) NOT NULL,
`migrated_from` bigint DEFAULT '0',
`migrated_date_time` datetime DEFAULT NULL,
`migrated_ewallet` decimal(14,4) DEFAULT '0.0000',
`migrated_car_fund` decimal(12,2) DEFAULT '0.00',
`migrated_house_fund` decimal(12,2) DEFAULT '0.00',
`migrated_by` varchar(100) DEFAULT NULL,
`prefix` varchar(20) DEFAULT '',
`nationality` varchar(20) DEFAULT '',
`member_code` varchar(20) DEFAULT '',
`generation` int NOT NULL DEFAULT '1',
`member_rank` varchar(20) DEFAULT 'NA',
`rank_council` varchar(20) DEFAULT 'NA',
`highest_rank` varchar(20) DEFAULT 'NA',
`identity_type` varchar(5) DEFAULT 'NIC',
`identity_no` varchar(100) DEFAULT '',
`passport_no` varchar(100) DEFAULT '',
`email` varchar(255) DEFAULT NULL,
`phone_no_prefix` varchar(50) DEFAULT '',
`phone_no` varchar(100) DEFAULT '',
`phone_no_combined` varchar(200) GENERATED ALWAYS AS (concat(trim(`phone_no_prefix`),trim(`phone_no`))) STORED,
`member_type` varchar(3) DEFAULT 'N',
`date_join` date DEFAULT NULL,
`date_expiry` date DEFAULT NULL,
`dob` date DEFAULT NULL,
`salutation_id` bigint DEFAULT '0',
`name` varchar(255) DEFAULT NULL,
`other_name` varchar(255) DEFAULT NULL,
`surname` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`nickname` varchar(255) DEFAULT '',
`sponsor_id` varchar(45) DEFAULT NULL,
`status` varchar(3) NOT NULL DEFAULT 'P',
`status_sub` varchar(15) NOT NULL DEFAULT 'NA',
`kyc_flag` varchar(5) NOT NULL DEFAULT 'N',
`kyc_manual_flag` varchar(5) NOT NULL DEFAULT 'N',
`gender` varchar(3) DEFAULT 'M',
`race` varchar(3) DEFAULT 'O',
`marrital_status` varchar(3) DEFAULT 'S',
`local_tax_resident` varchar(5) NOT NULL DEFAULT 'N',
`withholding_tax` varchar(5) NOT NULL DEFAULT 'N',
`withholding_tax_number` varchar(50) DEFAULT '',
`income_tax_no` varchar(255) DEFAULT '',
`address_location` varchar(50) DEFAULT '',
`town` varchar(255) DEFAULT '',
`address_details` varchar(250) DEFAULT '',
`post_code` varchar(20) DEFAULT '',
`spouse_name` varchar(255) DEFAULT '',
`spouse_identity_type` varchar(3) DEFAULT 'NIC',
`spouse_identity_no` varchar(50) DEFAULT '',
`spouse_passport_no` varchar(50) DEFAULT '',
`spouse_phone_no_prefix` varchar(50) DEFAULT '',
`spouse_phone_no` varchar(100) DEFAULT '',
`spouse_phone_no_combined` varchar(200) GENERATED ALWAYS AS (concat(trim(`spouse_phone_no_prefix`),trim(`spouse_phone_no`))) STORED,
`bank_id` bigint DEFAULT '0',
`payee_name` varchar(255) DEFAULT '',
`payee_identity_type` varchar(3) DEFAULT 'NIC',
`payee_identity_no` varchar(50) DEFAULT '',
`bank_account_no` varchar(100) DEFAULT '',
`is_mp` varchar(5) DEFAULT 'N',
`mp_phone_no` varchar(50) DEFAULT '',
`mp_identity_no` varchar(50) DEFAULT '',
`mp_prepaid_card` varchar(5) DEFAULT 'N',
`mp_prepaid_card_no` varchar(50) DEFAULT '',
`mp_prepaid_card_expiry_month` varchar(5) DEFAULT '',
`mp_prepaid_card_expiry_year` varchar(5) DEFAULT '',
`beneficiary_name` varchar(255) DEFAULT '',
`beneficiary_identity_type` varchar(3) DEFAULT 'NIC',
`beneficiary_identity_no` varchar(50) DEFAULT '',
`beneficiary_relation` varchar(50) DEFAULT '',
`beneficiary_phone_no_prefix` varchar(50) DEFAULT '',
`beneficiary_phone_no` varchar(100) DEFAULT '',
`remarks` varchar(255) DEFAULT '',
`device_model` varchar(45) DEFAULT NULL,
`app_version` varchar(45) DEFAULT NULL,
`preferred_language` json DEFAULT NULL,
`agree_randr` varchar(1) NOT NULL DEFAULT 'N',
`agree_pdpa` varchar(1) NOT NULL DEFAULT 'N',
`create_by` varchar(200) DEFAULT NULL,
`create_date` datetime NOT NULL,
`done_by` varchar(200) NOT NULL,
`status_remark` varchar(200) DEFAULT NULL,
`email_emrm` varchar(255) DEFAULT NULL,
`phone_no_emrm` varchar(255) DEFAULT NULL,
`address_emrm` text,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`last_purchase_bd_treat_date` date DEFAULT NULL,
`from_emrm` varchar(5) NOT NULL DEFAULT 'N',
`emrm_profile_update` varchar(5) NOT NULL DEFAULT 'N',
`last_purchase_new_retention_date` date DEFAULT NULL,
`npwp_id` bigint DEFAULT NULL,
`npwp_flag` varchar(5) DEFAULT 'NA',
`reg_rewards` varchar(5) NOT NULL DEFAULT 'N',
`profile_gift` varchar(5) NOT NULL DEFAULT 'N',
`profile_gift_date_time` datetime DEFAULT NULL,
`profile_gift_by` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid_UNIQUE` (`uuid`),
KEY `IDX_JOINDATE` (`date_join`),
KEY `IDX_STATUS` (`status`),
KEY `IDX_MEMBERCODE` (`member_code`),
KEY `IDX_TYPE` (`member_type`),
KEY `IDX_BNS_MBR` (`date_join`,`member_type`,`status`),
KEY `IDX_SPONSOR` (`sponsor_id`),
KEY `IDX_EXP_MBR` (`date_expiry`,`status`,`member_type`),
KEY `IDX_IDENTITY_NO` (`identity_no`),
KEY `idx_username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `TRIGGER_LOG_CHANGE_SPONSOR` BEFORE UPDATE ON `member` FOR EACH ROW BEGIN
DECLARE V_OLD_SPONSOR_ID BIGINT DEFAULT '0';
DECLARE V_OLD_SPONSOR_CODE VARCHAR(255) DEFAULT '';
DECLARE V_OLD_SPONSOR_NAME VARCHAR(255) DEFAULT '';
DECLARE V_NEW_SPONSOR_ID BIGINT DEFAULT '0';
DECLARE V_NEW_SPONSOR_CODE VARCHAR(255) DEFAULT '';
DECLARE V_NEW_SPONSOR_NAME VARCHAR(255) DEFAULT '';
IF (NEW.sponsor_id <> OLD.sponsor_id) THEN
SELECT `id`,`member_code`,`name`
INTO V_OLD_SPONSOR_ID, V_OLD_SPONSOR_CODE, V_OLD_SPONSOR_NAME
FROM `service-member`.`member`
WHERE `member_code` = OLD.sponsor_id;
SELECT `id`,`member_code`,`name`
INTO V_NEW_SPONSOR_ID, V_NEW_SPONSOR_CODE, V_NEW_SPONSOR_NAME
FROM `service-member`.`member`
WHERE `member_code` = NEW.sponsor_id;
INSERT INTO `service-member`.`sponsor_history`
(
`member_id`, `member_code`,`member_name`,
`old_sponsor_id`, `old_sponsor_code`,`old_sponsor_name`,
`new_sponsor_id`, `new_sponsor_code`,`new_sponsor_name`,
`remarks`, `create_date_time`,
`done_by`
)
VALUES
(
NEW.id, NEW.member_code, NEW.name,
V_OLD_SPONSOR_ID, OLD.sponsor_id, V_OLD_SPONSOR_NAME,
V_NEW_SPONSOR_ID, NEW.sponsor_id, V_NEW_SPONSOR_NAME,
NEW.remarks, NOW(),
NEW.done_by
);
-- Remove Remarks
SET NEW.remarks = '';
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_log_member_status` BEFORE UPDATE ON `member` FOR EACH ROW BEGIN
DECLARE v_member_id BIGINT DEFAULT '0';
DECLARE v_member_code VARCHAR(255) DEFAULT '';
DECLARE v_member_name VARCHAR(255) DEFAULT '';
IF (NEW.status <> OLD.status OR NEW.status_sub <> OLD.status_sub) THEN
INSERT INTO history_member_status
(
member_id,
member_code,
member_name,
uuid,
join_date,
old_status,
new_status,
old_status_sub,
new_status_sub,
status_remark,
done_by,
create_date_time)
values
(
NEW.id,
NEW.member_code,
NEW.name,
NEW.uuid,
NEW.date_join,
OLD.status,
NEW.status,
OLD.status_sub,
NEW.status_sub,
NEW.status_remark,
NEW.done_by,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `trigger_log_member_bank_details` BEFORE UPDATE ON `member` FOR EACH ROW BEGIN
DECLARE v_member_id BIGINT DEFAULT '0';
DECLARE v_member_code VARCHAR(255) DEFAULT '';
DECLARE v_member_name VARCHAR(255) DEFAULT '';
IF (NEW.bank_id <> OLD.bank_id OR NEW.payee_name <> OLD.payee_name OR NEW.payee_identity_type <> OLD.payee_identity_type or NEW.payee_identity_no <> OLD.payee_identity_no OR NEW.bank_account_no <> OLD.bank_account_no
or NEW.is_mp <> OLD.is_mp or NEW.mp_phone_no <> OLD.mp_phone_no or NEW.mp_identity_no <> OLD.mp_identity_no or NEW.mp_prepaid_card <> OLD.mp_prepaid_card
or NEW.mp_prepaid_card_no <> OLD.mp_prepaid_card_no or NEW.mp_prepaid_card_expiry_month <> OLD.mp_prepaid_card_expiry_month or NEW.mp_prepaid_card_expiry_year <> OLD.mp_prepaid_card_expiry_year) THEN
INSERT INTO history_member_bank_details
(
member_id,
member_code,
member_name,
old_bank_id,
new_bank_id,
old_payee_name,
new_payee_name,
old_payee_identity_type,
new_payee_identity_type,
old_payee_identity_no,
new_payee_identity_no,
old_bank_account_no,
new_bank_account_no,
old_is_mp,
new_is_mp,
old_mp_phone_no,
new_mp_phone_no,
old_mp_identity_no,
new_mp_identity_no,
old_mp_prepaid_card,
new_mp_prepaid_card,
old_mp_prepaid_card_no,
new_mp_prepaid_card_no,
old_mp_prepaid_card_expiry_month,
new_mp_prepaid_card_expiry_month,
old_mp_prepaid_card_expiry_year,
new_mp_prepaid_card_expiry_year,
done_by,
create_date_time)
values
(
NEW.id,
NEW.member_code,
NEW.name,
OLD.bank_id,
NEW.bank_id,
OLD.payee_name,
NEW.payee_name,
OLD.payee_identity_type,
NEW.payee_identity_type,
OLD.payee_identity_no,
NEW.payee_identity_no,
OLD.bank_account_no,
NEW.bank_account_no,
OLD.is_mp,
NEW.is_mp,
OLD.mp_phone_no,
NEW.mp_phone_no,
OLD.mp_identity_no,
NEW.mp_identity_no,
OLD.mp_prepaid_card,
NEW.mp_prepaid_card,
OLD.mp_prepaid_card_no,
NEW.mp_prepaid_card_no,
OLD.mp_prepaid_card_expiry_month,
NEW.mp_prepaid_card_expiry_month,
OLD.mp_prepaid_card_expiry_year,
NEW.mp_prepaid_card_expiry_year,
NEW.done_by,
now());
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `generate_member_code` BEFORE UPDATE ON `member` FOR EACH ROW BEGIN
IF (OLD.status='P' AND NEW.status='Y' ) THEN
IF(OLD.member_code='' OR OLD.member_code IS NULL) THEN
/*CALL proc_generate_member_code(NEW.id);*/
SET NEW.member_code=func__generate_member_code(NEW.id);
END IF;
/*Default USERNAME at the beginning, follow memberCode*/
IF(OLD.username='' OR OLD.username IS NULL) THEN
SET NEW.username = NEW.member_code;
END IF;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `TRIGGER_LOG_CHANGE_MEMBER` BEFORE UPDATE ON `member` FOR EACH ROW BEGIN
INSERT INTO `audit_trail_member` (
`id`,
`revision_timestamp`,
`last_done`,
`old_id`,
`new_id`,
`uuid`,
`new_uuid`,
`migrated_from`,
`new_migrated_from`,
`migrated_date_time`,
`new_migrated_date_time`,
`migrated_ewallet`,
`new_migrated_ewallet`,
`migrated_car_fund`,
`new_migrated_car_fund`,
`migrated_house_fund`,
`new_migrated_house_fund`,
`migrated_by`,
`new_migrated_by`,
`prefix`,
`new_prefix`,
`nationality`,
`new_nationality`,
`member_code`,
`new_member_code`,
`generation`,
`new_generation`,
`member_rank`,
`new_member_rank`,
`rank_council`,
`new_rank_council`,
`highest_rank`,
`new_highest_rank`,
`identity_type`,
`new_identity_type`,
`identity_no`,
`new_identity_no`,
`passport_no`,
`new_passport_no`,
`email`,
`new_email`,
`phone_no_prefix`,
`new_phone_no_prefix`,
`phone_no`,
`new_phone_no`,
`phone_no_combined`,
`new_phone_no_combined`,
`member_type`,
`new_member_type`,
`date_join`,
`new_date_join`,
`date_expiry`,
`new_date_expiry`,
`dob`,
`new_dob`,
`salutation_id`,
`new_salutation_id`,
`name`,
`new_name`,
`other_name`,
`new_other_name`,
`surname`,
`new_surname`,
`username`,
`new_username`,
`nickname`,
`new_nickname`,
`sponsor_id`,
`new_sponsor_id`,
`status`,
`new_status`,
`status_sub`,
`new_status_sub`,
`kyc_flag`,
`new_kyc_flag`,
`kyc_manual_flag`,
`new_kyc_manual_flag`,
`gender`,
`new_gender`,
`race`,
`new_race`,
`marrital_status`,
`new_marrital_status`,
`local_tax_resident`,
`new_local_tax_resident`,
`withholding_tax`,
`new_withholding_tax`,
`withholding_tax_number`,
`new_withholding_tax_number`,
`income_tax_no`,
`new_income_tax_no`,
`address_location`,
`new_address_location`,
`address_details`,
`new_address_details`,
`post_code`,
`new_post_code`,
`spouse_name`,
`new_spouse_name`,
`spouse_identity_type`,
`new_spouse_identity_type`,
`spouse_identity_no`,
`new_spouse_identity_no`,
`spouse_passport_no`,
`new_spouse_passport_no`,
`spouse_phone_no_prefix`,
`new_spouse_phone_no_prefix`,
`spouse_phone_no`,
`new_spouse_phone_no`,
`spouse_phone_no_combined`,
`new_spouse_phone_no_combined`,
`bank_id`,
`new_bank_id`,
`payee_name`,
`new_payee_name`,
`payee_identity_type`,
`new_payee_identity_type`,
`payee_identity_no`,
`new_payee_identity_no`,
`bank_account_no`,
`new_bank_account_no`,
`is_mp`,
`new_is_mp`,
`mp_phone_no`,
`new_mp_phone_no`,
`mp_identity_no`,
`new_mp_identity_no`,
`mp_prepaid_card`,
`new_mp_prepaid_card`,
`mp_prepaid_card_no`,
`new_mp_prepaid_card_no`,
`mp_prepaid_card_expiry_month`,
`new_mp_prepaid_card_expiry_month`,
`mp_prepaid_card_expiry_year`,
`new_mp_prepaid_card_expiry_year`,
`beneficiary_name`,
`new_beneficiary_name`,
`beneficiary_identity_type`,
`new_beneficiary_identity_type`,
`beneficiary_identity_no`,
`new_beneficiary_identity_no`,
`beneficiary_relation`,
`new_beneficiary_relation`,
`beneficiary_phone_no_prefix`,
`new_beneficiary_phone_no_prefix`,
`beneficiary_phone_no`,
`new_beneficiary_phone_no`,
`remarks`,
`new_remarks`,
`device_model`,
`new_device_model`,
`app_version`,
`new_app_version`,
`agree_randr`,
`new_agree_randr`,
`agree_pdpa`,
`new_agree_pdpa`,
`create_by`,
`new_create_by`,
`create_date`,
`new_create_date`,
`done_by`,
`status_remark`,
`new_status_remark`,
`new_done_by`,
`email_emrm`,
`new_email_emrm`,
`phone_no_emrm`,
`new_phone_no_emrm`,
`address_emrm`,
`new_address_emrm`,
`from_emrm`,
`new_from_emrm`,
`emrm_profile_update`,
`new_emrm_profile_update`,
`preferred_language`,
`new_preferred_language`,
`last_purchase_bd_treat_date`,
`new_last_purchase_bd_treat_date`,
`last_purchase_new_retention_date`,
`new_last_purchase_new_retention_date`,
`npwp_id`,
`new_npwp_id`,
`npwp_flag`,
`new_npwp_flag`,
`reg_rewards`,
`new_reg_rewards`,
`town`,
`new_town`,
`profile_gift`,
`new_profile_gift`,
`profile_gift_date_time`,
`new_profile_gift_date_time`,
`profile_gift_by`,
`new_profile_gift_by`
)
VALUES (
NULL,
NOW(),
NEW.done_by,
OLD.id,
NEW.id,
OLD.uuid,
NEW.uuid,
OLD.migrated_from,
NEW.migrated_from,
OLD.migrated_date_time,
NEW.migrated_date_time,
OLD.migrated_ewallet,
NEW.migrated_ewallet,
OLD.migrated_car_fund,
NEW.migrated_car_fund,
OLD.migrated_house_fund,
NEW.migrated_house_fund,
OLD.migrated_by,
NEW.migrated_by,
OLD.prefix,
NEW.prefix,
OLD.nationality,
NEW.nationality,
OLD.member_code,
NEW.member_code,
OLD.generation,
NEW.generation,
OLD.member_rank,
NEW.member_rank,
OLD.rank_council,
NEW.rank_council,
OLD.highest_rank,
NEW.highest_rank,
OLD.identity_type,
NEW.identity_type,
OLD.identity_no,
NEW.identity_no,
OLD.passport_no,
NEW.passport_no,
OLD.email,
NEW.email,
OLD.phone_no_prefix,
NEW.phone_no_prefix,
OLD.phone_no,
NEW.phone_no,
OLD.phone_no_combined,
NEW.phone_no_combined,
OLD.member_type,
NEW.member_type,
OLD.date_join,
NEW.date_join,
OLD.date_expiry,
NEW.date_expiry,
OLD.dob,
NEW.dob,
OLD.salutation_id,
NEW.salutation_id,
OLD.name,
NEW.name,
OLD.other_name,
NEW.other_name,
OLD.surname,
NEW.surname,
OLD.username,
NEW.username,
OLD.nickname,
NEW.nickname,
OLD.sponsor_id,
NEW.sponsor_id,
OLD.status,
NEW.status,
OLD.status_sub,
NEW.status_sub,
OLD.kyc_flag,
NEW.kyc_flag,
OLD.kyc_manual_flag,
NEW.kyc_manual_flag,
OLD.gender,
NEW.gender,
OLD.race,
NEW.race,
OLD.marrital_status,
NEW.marrital_status,
OLD.local_tax_resident,
NEW.local_tax_resident,
OLD.withholding_tax,
NEW.withholding_tax,
OLD.withholding_tax_number,
NEW.withholding_tax_number,
OLD.income_tax_no,
NEW.income_tax_no,
OLD.address_location,
NEW.address_location,
OLD.address_details,
NEW.address_details,
OLD.post_code,
NEW.post_code,
OLD.spouse_name,
NEW.spouse_name,
OLD.spouse_identity_type,
NEW.spouse_identity_type,
OLD.spouse_identity_no,
NEW.spouse_identity_no,
OLD.spouse_passport_no,
NEW.spouse_passport_no,
OLD.spouse_phone_no_prefix,
NEW.spouse_phone_no_prefix,
OLD.spouse_phone_no,
NEW.spouse_phone_no,
OLD.spouse_phone_no_combined,
NEW.spouse_phone_no_combined,
OLD.bank_id,
NEW.bank_id,
OLD.payee_name,
NEW.payee_name,
OLD.payee_identity_type,
NEW.payee_identity_type,
OLD.payee_identity_no,
NEW.payee_identity_no,
OLD.bank_account_no,
NEW.bank_account_no,
OLD.is_mp,
NEW.is_mp,
OLD.mp_phone_no,
NEW.mp_phone_no,
OLD.mp_identity_no,
NEW.mp_identity_no,
OLD.mp_prepaid_card,
NEW.mp_prepaid_card,
OLD.mp_prepaid_card_no,
NEW.mp_prepaid_card_no,
OLD.mp_prepaid_card_expiry_month,
NEW.mp_prepaid_card_expiry_month,
OLD.mp_prepaid_card_expiry_year,
NEW.mp_prepaid_card_expiry_year,
OLD.beneficiary_name,
NEW.beneficiary_name,
OLD.beneficiary_identity_type,
NEW.beneficiary_identity_type,
OLD.beneficiary_identity_no,
NEW.beneficiary_identity_no,
OLD.beneficiary_relation,
NEW.beneficiary_relation,
OLD.beneficiary_phone_no_prefix,
NEW.beneficiary_phone_no_prefix,
OLD.beneficiary_phone_no,
NEW.beneficiary_phone_no,
OLD.remarks,
NEW.remarks,
OLD.device_model,
NEW.device_model,
OLD.app_version,
NEW.app_version,
OLD.agree_randr,
NEW.agree_randr,
OLD.agree_pdpa,
NEW.agree_pdpa,
OLD.create_by,
NEW.create_by,
OLD.create_date,
NEW.create_date,
OLD.done_by,
OLD.status_remark,
NEW.status_remark,
NEW.done_by,
OLD.email_emrm,
NEW.email_emrm,
OLD.phone_no_emrm,
NEW.phone_no_emrm,
OLD.address_emrm,
NEW.address_emrm,
OLD.from_emrm,
NEW.from_emrm,
OLD.emrm_profile_update,
NEW.emrm_profile_update,
OLD.preferred_language,
NEW.preferred_language,
OLD.last_purchase_bd_treat_date,
NEW.last_purchase_bd_treat_date,
OLD.last_purchase_new_retention_date,
NEW.last_purchase_new_retention_date,
OLD.npwp_id,
NEW.npwp_id,
OLD.npwp_flag,
NEW.npwp_flag,
OLD.reg_rewards,
NEW.reg_rewards,
OLD.town,
NEW.town,
OLD.profile_gift,
NEW.profile_gift,
OLD.profile_gift_date_time,
NEW.profile_gift_date_time,
OLD.profile_gift_by,
NEW.profile_gift_by
);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `nationality`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `nationality` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL,
`iso_code` varchar(50) DEFAULT '',
`name` varchar(255) DEFAULT NULL,
`message_tag` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `code_UNIQUE` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `network_tree`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `network_tree` (
`mbid` varchar(25) NOT NULL,
`parentid` varchar(25) DEFAULT NULL,
`tracekey` longtext,
`level` int DEFAULT NULL,
PRIMARY KEY (`mbid`),
KEY `IDX_PARENT` (`parentid`),
KEY `IDX_LEVEL` (`level`),
KEY `IDX_TRACEKEY` (`tracekey`(500)),
FULLTEXT KEY `IDX_TRACEKEY_TEXT` (`tracekey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `preferred_language`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `preferred_language` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_RaceCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `pregnancy`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pregnancy` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`estimated_due_date` date DEFAULT NULL,
`weeks_of_pregnancy` int DEFAULT NULL,
`current_check_up_location` varchar(255) DEFAULT NULL,
`gender` varchar(5) DEFAULT NULL,
`create_by` varchar(100) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `pregnancy_kick_count`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pregnancy_kick_count` (
`id` bigint NOT NULL AUTO_INCREMENT,
`pregnancy_id` bigint DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_P_ID` (`pregnancy_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `race`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `race` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
`message_tag` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_RaceCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `salutation`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `salutation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT '',
`name` varchar(255) DEFAULT '',
`message_tag` varchar(255) DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UC_SalutionCode` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sponsor_history`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sponsor_history` (
`id` bigint NOT NULL AUTO_INCREMENT,
`member_id` bigint DEFAULT NULL,
`member_code` varchar(250) DEFAULT NULL,
`member_name` varchar(250) DEFAULT NULL,
`old_sponsor_id` bigint DEFAULT NULL,
`old_sponsor_code` varchar(250) DEFAULT NULL,
`old_sponsor_name` varchar(250) DEFAULT NULL,
`new_sponsor_id` bigint DEFAULT NULL,
`new_sponsor_code` varchar(250) DEFAULT NULL,
`new_sponsor_name` varchar(250) DEFAULT NULL,
`remarks` varchar(255) DEFAULT NULL,
`done_by` varchar(50) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`last_modify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `undo_log`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `undo_log` (
`id` bigint NOT NULL AUTO_INCREMENT,
`branch_id` bigint NOT NULL,
`xid` varchar(100) NOT NULL,
`context` varchar(128) NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int NOT NULL,
`log_created` datetime NOT NULL,
`log_modified` datetime NOT NULL,
`ext` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping routines for database 'service-member'
--
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `func__generate_customer_code`(IN_ID BIGINT) RETURNS varchar(50) CHARSET utf8mb3
BEGIN
DECLARE RUNNING_NUMBER INT DEFAULT 0;
DECLARE MAX_NUMBER INT DEFAULT 99999999;
DECLARE MIN_NUMBER INT DEFAULT 1;
DECLARE V_MEMBER_CODE VARCHAR(255) DEFAULT '';
DECLARE V_MEMBER_PREFIX VARCHAR(5) DEFAULT '';
SELECT `customer_code`, `prefix`
INTO V_MEMBER_CODE, V_MEMBER_PREFIX
FROM `service-member`.`customer`
where `id`= IN_ID LIMIT 1;
IF (V_MEMBER_CODE = '' OR V_MEMBER_CODE IS NULL) THEN
CHECK_EXIST:LOOP
SET RUNNING_NUMBER = FLOOR((RAND() * (MAX_NUMBER-MIN_NUMBER+1))+MIN_NUMBER);
SET V_MEMBER_CODE = LPAD(RUNNING_NUMBER, 8, 0);
IF NOT EXISTS (SELECT (1) FROM `customer` WHERE substring(`customer_code`, 5, 10) = V_MEMBER_CODE) THEN
LEAVE CHECK_EXIST;
END IF;
END LOOP CHECK_EXIST;
SET V_MEMBER_CODE = CONCAT('PC',V_MEMBER_PREFIX, V_MEMBER_CODE) ;
END IF;
RETURN V_MEMBER_CODE;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `func__generate_member_code`(IN_ID BIGINT) RETURNS varchar(50) CHARSET utf8mb3
BEGIN
DECLARE RUNNING_NUMBER INT DEFAULT 0;
DECLARE MAX_NUMBER INT DEFAULT 99999999;
DECLARE MIN_NUMBER INT DEFAULT 1;
DECLARE V_MEMBER_CODE VARCHAR(255) DEFAULT '';
DECLARE V_MEMBER_PREFIX VARCHAR(5) DEFAULT '';
SELECT `member_code`, `prefix`
INTO V_MEMBER_CODE, V_MEMBER_PREFIX
FROM `service-member`.`member`
where `id`= IN_ID LIMIT 1;
IF (V_MEMBER_CODE = '' OR V_MEMBER_CODE IS NULL) THEN
CHECK_EXIST:LOOP
SET RUNNING_NUMBER = FLOOR((RAND() * (MAX_NUMBER-MIN_NUMBER+1))+MIN_NUMBER);
SET V_MEMBER_CODE = LPAD(RUNNING_NUMBER, 8, 0);
IF NOT EXISTS (SELECT (1) FROM `member` WHERE `member_code` = V_MEMBER_CODE) THEN
LEAVE CHECK_EXIST;
END IF;
END LOOP CHECK_EXIST;
-- SET V_MEMBER_CODE = CONCAT(V_MEMBER_PREFIX, V_MEMBER_CODE) ;
/* UPDATE `service-member`.`member` set `member_code` = V_MEMBER_CODE WHERE `id`= IN_ID AND `member_code`='';*/
END IF;
RETURN V_MEMBER_CODE;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `getMemberCodeAndName`(memberCode VARCHAR(100)) RETURNS varchar(100) CHARSET utf8mb3
BEGIN
DECLARE v_member_code VARCHAR(100) DEFAULT memberCode;
DECLARE v_member_name varchar(200) DEFAULT '';
DECLARE v_sponsor_id VARCHAR(100) DEFAULT '';
DECLARE v_sponsor_rank VARCHAR(50) DEFAULT '';
SELECT `member_code`,`name`,`rank_council`, `sponsor_id`
into v_member_code, v_member_name, v_sponsor_rank, v_sponsor_id
FROM `member` where member_code= v_member_code;
RETURN CONCAT(v_member_code,'@#;',v_member_name) ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `getNearestMemberEcaDca`(memberCode VARCHAR(100)) RETURNS varchar(100) CHARSET utf8mb3
BEGIN
DECLARE v_member_code VARCHAR(100) DEFAULT memberCode;
DECLARE v_member_name varchar(200) DEFAULT '';
DECLARE v_sponsor_id VARCHAR(100) DEFAULT '';
DECLARE v_sponsor_rank VARCHAR(50) DEFAULT '';
DECLARE v_tree_level int DEFAULT 0;
DECLARE isFound varchar(5) DEFAULT 'N';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_member_code = NULL, v_member_name=null;
WHILE (isFound='N' AND v_member_code is not null and v_member_code != '') DO
SELECT `member_code`,`name`,`rank_council`, `sponsor_id`, `level`
into v_member_code, v_member_name, v_sponsor_rank, v_sponsor_id, v_tree_level
FROM `member` LEFT JOIN `network_tree` on member_code=mbid
where member_code= v_member_code;
IF v_member_code is not null THEN
IF v_sponsor_rank = 'ECA' OR v_sponsor_rank='DCA' THEN
SET isFound='Y';
ELSE
SET v_member_code=v_sponsor_id;
END IF;
END IF;
END WHILE;
RETURN CONCAT(v_member_code,'@#;',v_member_name, '@#;', v_sponsor_rank,'@#;', v_tree_level) ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `getNearestMemberMemberRankExcludeSelf`(memberCode VARCHAR(100), targetRank VARCHAR(50)) RETURNS varchar(100) CHARSET utf8mb3
BEGIN
DECLARE v_member_code VARCHAR(100) DEFAULT memberCode;
DECLARE v_member_name varchar(200) DEFAULT '';
DECLARE v_sponsor_id VARCHAR(100) DEFAULT '';
DECLARE v_sponsor_rank VARCHAR(50) DEFAULT '';
DECLARE v_tree_level int DEFAULT 0;
DECLARE isFound varchar(5) DEFAULT 'N';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_member_code = NULL, v_member_name=null;
WHILE (isFound='N' AND v_member_code is not null and v_member_code != '') DO
SELECT `member_code`,`name`,`rank`, `sponsor_id`, `level`
into v_member_code, v_member_name, v_sponsor_rank, v_sponsor_id, v_tree_level
FROM `member` LEFT JOIN `network_tree` on member_code=mbid
where member_code= v_member_code;
IF v_member_code is not null THEN
IF v_member_code=memberCode THEN
SET v_member_code=v_sponsor_id;
ELSEIF v_sponsor_rank = targetRank THEN
SET isFound='Y';
ELSE
SET v_member_code=v_sponsor_id;
END IF;
END IF;
END WHILE;
RETURN CONCAT(v_member_code,'@#;',v_member_name,'@#;', v_tree_level) ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `getNearestMemberRank`(memberCode VARCHAR(100), targetRank VARCHAR(50)) RETURNS varchar(100) CHARSET utf8mb3
BEGIN
DECLARE v_member_code VARCHAR(100) DEFAULT memberCode;
DECLARE v_member_name varchar(200) DEFAULT '';
DECLARE v_sponsor_id VARCHAR(100) DEFAULT '';
DECLARE v_sponsor_rank VARCHAR(50) DEFAULT '';
DECLARE isFound varchar(5) DEFAULT 'N';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_member_code = NULL, v_member_name=null;
WHILE (isFound='N' AND v_member_code is not null and v_member_code != '') DO
SELECT `member_code`,`name`,`rank_council`, `sponsor_id`
into v_member_code, v_member_name, v_sponsor_rank, v_sponsor_id
FROM `member` where member_code= v_member_code;
IF v_member_code is not null THEN
IF v_sponsor_rank = targetRank THEN
SET isFound='Y';
ELSE
SET v_member_code=v_sponsor_id;
END IF;
END IF;
END WHILE;
RETURN CONCAT(v_member_code,'@#;',v_member_name) ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE FUNCTION `getNearestMemberRankExcludeSelf`(memberCode VARCHAR(100), targetRank VARCHAR(50)) RETURNS varchar(100) CHARSET utf8mb3
BEGIN
DECLARE v_member_code VARCHAR(100) DEFAULT memberCode;
DECLARE v_member_name varchar(200) DEFAULT '';
DECLARE v_sponsor_id VARCHAR(100) DEFAULT '';
DECLARE v_sponsor_rank VARCHAR(50) DEFAULT '';
DECLARE v_tree_level int DEFAULT 0;
DECLARE isFound varchar(5) DEFAULT 'N';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_member_code = NULL, v_member_name=null;
WHILE (isFound='N' AND v_member_code is not null and v_member_code != '') DO
SELECT `member_code`,`name`,`rank_council`, `sponsor_id`, `level`
into v_member_code, v_member_name, v_sponsor_rank, v_sponsor_id, v_tree_level
FROM `member` LEFT JOIN `network_tree` on member_code=mbid
where member_code= v_member_code;
IF v_member_code is not null THEN
IF v_member_code=memberCode THEN
SET v_member_code=v_sponsor_id;
ELSEIF v_sponsor_rank = targetRank THEN
SET isFound='Y';
ELSE
SET v_member_code=v_sponsor_id;
END IF;
END IF;
END WHILE;
RETURN CONCAT(v_member_code,'@#;',v_member_name,'@#;', v_tree_level) ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
CREATE PROCEDURE `PROC_INSERT_CHANGE_LOG`(IN SRC_TABLE VARCHAR(200),
IN TARGET_TABLE VARCHAR(200),
IN PRIMARY_KEY_FIELD VARCHAR(200),
IN PRIMARY_KEY_VALUE VARCHAR(200),
OUT STR_RETURN TEXT
)
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE NEW_VALUE TEXT;
DECLARE SQL_STMT TEXT;
DECLARE LOOP_COUNT INT DEFAULT 0;
DECLARE COLS VARCHAR(200);
DECLARE CUR CURSOR FOR SELECT COLUMN_NAME FROM TEMP_VIEW_COLUMNS;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-- Dynamic view definition and creation
SET @v = concat('CREATE OR REPLACE VIEW TEMP_VIEW_COLUMNS as SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema="service-member" AND table_name="',SRC_TABLE,'" ORDER BY ordinal_position');
PREPARE VIEW_STMT FROM @v;
EXECUTE VIEW_STMT;
DEALLOCATE PREPARE VIEW_STMT;
SET SQL_STMT =CONCAT('INSERT INTO `service-member`.`',TARGET_TABLE,'` (`new_value`) SELECT JSON_OBJECT(');
SET NEW_VALUE='';
OPEN CUR;
LOOP_1: LOOP
FETCH CUR INTO COLS;
IF done THEN
LEAVE LOOP_1;
SET SQL_STMT="HEllo";
END IF;
/*ADD COMMA TO JSON OBJECT FIELD IF PREVIOUSLY GOT DATA*/
IF LOOP_COUNT >0 THEN
SET NEW_VALUE = CONCAT(NEW_VALUE,',');
END IF;
SET NEW_VALUE = CONCAT(NEW_VALUE,'"',COLS,'",',COLS);
SET LOOP_COUNT = LOOP_COUNT + 1;
-- -- IF OLD.COLUMN_NAME != NEW.COLUMN_NAME THEN
-- -- /*ADD COMMA TO JSON OBJECT FIELD IF PREVIOUSLY GOT DATA*/
-- -- IF LOOP_COUNT >0 THEN
-- -- SET OLD_VALUE = CONCAT(OLD_VALUE,',');
-- -- SET NEW_VALUE = CONCAT(NEW_VALUE,',');
-- -- END IF;
-- -- SET OLD_VALUE = CONCAT(OLD_VALUE, '"',COLUMN_NAME,'":','"',OLD.COLUMN_NAME,'"');
-- -- SET NEW_VALUE = CONCAT(NEW_VALUE, '"',COLUMN_NAME,'":','"',NEW.COLUMN_NAME,'"');
-- -- SET LOOP_COUNT = LOOP_COUNT + 1;
-- -- END IF;
END LOOP;
CLOSE CUR;
SET SQL_STMT = CONCAT(SQL_STMT, NEW_VALUE, ') FROM ',SRC_TABLE,' WHERE ',PRIMARY_KEY_FIELD,'="',PRIMARY_KEY_VALUE,'"');
INSERT INTO `temp_hist` (`new_value`) values (SQL_STMT);
-- EXECUTE SQL_STMT;
-- DEALLOCATE PREPARE SQL_STMT;
SELECT SQL_STMT;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Final view structure for view `TEMP_VIEW_COLUMNS`
--
/*!50001 DROP VIEW IF EXISTS `TEMP_VIEW_COLUMNS`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8mb3 */;
/*!50001 SET character_set_results = utf8mb3 */;
/*!50001 SET collation_connection = utf8mb3_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 SQL SECURITY DEFINER */
/*!50001 VIEW `TEMP_VIEW_COLUMNS` AS select `information_schema`.`COLUMNS`.`COLUMN_NAME` AS `COLUMN_NAME` from `information_schema`.`COLUMNS` where ((`information_schema`.`COLUMNS`.`TABLE_SCHEMA` = 'service-member') and (`information_schema`.`COLUMNS`.`TABLE_NAME` = 'member')) order by `information_schema`.`COLUMNS`.`ORDINAL_POSITION` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!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 */;
-- Dump completed on 2026-11-26 16:13:30
USE `service-log`;
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: service-log
-- ------------------------------------------------------
-- Server version 8.4.8
/*!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 */;
/*!50503 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 */;
--
-- Table structure for table `back_office_access_log`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `back_office_access_log` (
`id` bigint NOT NULL AUTO_INCREMENT,
`user_name` varchar(100) DEFAULT NULL,
`date_time` datetime DEFAULT NULL,
`module` varchar(100) DEFAULT NULL,
`function_name` varchar(100) DEFAULT NULL,
`data_before` text,
`data_after` text,
`data_before_to_display` text,
`data_after_to_display` text,
`parameter` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `board_connection_status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `board_connection_status` (
`id` bigint NOT NULL AUTO_INCREMENT,
`board_model` varchar(45) DEFAULT NULL,
`branch_code` varchar(45) DEFAULT NULL,
`temperature` int DEFAULT NULL,
`random_log_connection_date_time` varchar(50) DEFAULT NULL,
`out_good_status` int DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `board_connection_status_BEFORE_INSERT` BEFORE INSERT ON `board_connection_status` FOR EACH ROW BEGIN
DECLARE id INT default 0;
SET id = (SELECT id FROM board_connection_status_main where branch_code = NEW.branch_code);
if(id is null)
then
INSERT INTO `board_connection_status_main`
(`id`,
`board_model`,
`branch_code`,
`temperature`,
`random_log_connection_date_time`,
`out_good_status`,
`create_date_time`)
VALUES
(null,
new.board_model,
new.branch_code,
new.temperature,
new.random_log_connection_date_time,
new.out_good_status,
new.create_date_time);
else
UPDATE `board_connection_status_main`
SET
`board_model` = new.board_model,
`branch_code` = new.branch_code,
`temperature` = new.temperature,
`random_log_connection_date_time` = new.random_log_connection_date_time,
`out_good_status` = new.out_good_status,
`create_date_time` = new.create_date_time
WHERE `id` = id;
end if;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `board_connection_status_main`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `board_connection_status_main` (
`id` bigint NOT NULL AUTO_INCREMENT,
`board_model` varchar(45) DEFAULT NULL,
`branch_code` varchar(45) DEFAULT NULL,
`temperature` int DEFAULT NULL,
`random_log_connection_date_time` varchar(50) DEFAULT NULL,
`out_good_status` int DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `branch_code_UNIQUE` (`branch_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `member_access_log`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `member_access_log` (
`id` bigint NOT NULL AUTO_INCREMENT,
`user_name` varchar(100) DEFAULT NULL,
`date_time` datetime DEFAULT NULL,
`module` varchar(100) DEFAULT NULL,
`function_name` varchar(100) DEFAULT NULL,
`data_before` text,
`data_after` text,
`data_before_to_display` text,
`data_after_to_display` text,
`parameter` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `post_event_snapshot_20260512`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `post_event_snapshot_20260512` (
`SCHEMA_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`DIGEST` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`DIGEST_TEXT` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`COUNT_STAR` bigint unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint unsigned NOT NULL,
`MIN_TIMER_WAIT` bigint unsigned NOT NULL,
`AVG_TIMER_WAIT` bigint unsigned NOT NULL,
`MAX_TIMER_WAIT` bigint unsigned NOT NULL,
`SUM_LOCK_TIME` bigint unsigned NOT NULL,
`SUM_ERRORS` bigint unsigned NOT NULL,
`SUM_WARNINGS` bigint unsigned NOT NULL,
`SUM_ROWS_AFFECTED` bigint unsigned NOT NULL,
`SUM_ROWS_SENT` bigint unsigned NOT NULL,
`SUM_ROWS_EXAMINED` bigint unsigned NOT NULL,
`SUM_CREATED_TMP_DISK_TABLES` bigint unsigned NOT NULL,
`SUM_CREATED_TMP_TABLES` bigint unsigned NOT NULL,
`SUM_SELECT_FULL_JOIN` bigint unsigned NOT NULL,
`SUM_SELECT_FULL_RANGE_JOIN` bigint unsigned NOT NULL,
`SUM_SELECT_RANGE` bigint unsigned NOT NULL,
`SUM_SELECT_RANGE_CHECK` bigint unsigned NOT NULL,
`SUM_SELECT_SCAN` bigint unsigned NOT NULL,
`SUM_SORT_MERGE_PASSES` bigint unsigned NOT NULL,
`SUM_SORT_RANGE` bigint unsigned NOT NULL,
`SUM_SORT_ROWS` bigint unsigned NOT NULL,
`SUM_SORT_SCAN` bigint unsigned NOT NULL,
`SUM_NO_INDEX_USED` bigint unsigned NOT NULL,
`SUM_NO_GOOD_INDEX_USED` bigint unsigned NOT NULL,
`SUM_CPU_TIME` bigint unsigned NOT NULL,
`MAX_CONTROLLED_MEMORY` bigint unsigned NOT NULL,
`MAX_TOTAL_MEMORY` bigint unsigned NOT NULL,
`COUNT_SECONDARY` bigint unsigned NOT NULL,
`FIRST_SEEN` timestamp(6) NOT NULL,
`LAST_SEEN` timestamp(6) NOT NULL,
`QUANTILE_95` bigint unsigned NOT NULL,
`QUANTILE_99` bigint unsigned NOT NULL,
`QUANTILE_999` bigint unsigned NOT NULL,
`QUERY_SAMPLE_TEXT` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`QUERY_SAMPLE_SEEN` timestamp(6) NOT NULL,
`QUERY_SAMPLE_TIMER_WAIT` bigint unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202408`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202408` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202409`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202409` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202410`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202410` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202411`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202411` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202412`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202412` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202501`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202501` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202502`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202502` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202503`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202503` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202504`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202504` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202505`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202505` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202506`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202506` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202507`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202507` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202508`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202508` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202509`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202509` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202510`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202510` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202511`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202511` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202512`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202512` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202601`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202601` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202602`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202602` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202603`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202603` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202604`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202604` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202605`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202605` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202606`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202606` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202607`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202607` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202608`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202608` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202609`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202609` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202610`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202610` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `response_time_archived_202611`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `response_time_archived_202611` (
`id` bigint NOT NULL,
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source_platform` varchar(10) NOT NULL,
`time_used_ms` bigint DEFAULT NULL,
`method` varchar(255) DEFAULT '',
`url` text,
`function_called` text,
`username` varchar(255) DEFAULT '',
`http_headers` text,
`user_agent` text,
PRIMARY KEY (`id`),
KEY `IDX_TIME` (`request_time`),
KEY `IDX_CMS` (`source_platform`),
KEY `IDX_TIME_CMS` (`request_time`,`source_platform`),
KEY `IDX_USERNAME` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping routines for database 'service-log'
--
/*!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 */;
-- Dump completed on 2026-11-26 16:13:21
USE `service-email`;
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: service-email
-- ------------------------------------------------------
-- Server version 8.4.8
/*!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 */;
/*!50503 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 */;
--
-- Table structure for table `attachment`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `attachment` (
`id` bigint NOT NULL AUTO_INCREMENT,
`file_name` varchar(100) NOT NULL,
`file_type` varchar(100) NOT NULL,
`data` longblob,
`base` longtext,
`datetime` datetime NOT NULL,
`email_id` bigint DEFAULT NULL,
`template_id` bigint DEFAULT NULL,
`status` varchar(5) DEFAULT 'N',
`bucket_file_id` text NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_EMAIL_ID` (`email_id`),
KEY `IDX_TEMPALTE_ID` (`template_id`),
KEY `IDX_EMAIL_TEMPLATE_ID` (`email_id`,`template_id`),
KEY `IDX_TEMPLATE_EMAIL_ID` (`template_id`,`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `email`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `email` (
`id` bigint NOT NULL AUTO_INCREMENT,
`sender` varchar(255) NOT NULL DEFAULT '',
`subject` text NOT NULL,
`body` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`datetime` datetime DEFAULT CURRENT_TIMESTAMP,
`status` varchar(1) NOT NULL DEFAULT 'P',
`lastmodify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`resend` smallint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `IDX_STATUS` (`status`),
FULLTEXT KEY `FULL_TXT_SUBJECT` (`subject`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `recipient`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `recipient` (
`id` bigint NOT NULL AUTO_INCREMENT,
`recipient` text NOT NULL,
`type` varchar(3) NOT NULL,
`email_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sms`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms` (
`id` bigint NOT NULL AUTO_INCREMENT,
`uuid` varchar(45) DEFAULT NULL,
`datetime` datetime DEFAULT NULL,
`recipient` varchar(255) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`status` varchar(5) NOT NULL DEFAULT 'P',
`resend` int DEFAULT '0',
`provider` varchar(45) DEFAULT NULL,
`provider_response` text,
PRIMARY KEY (`id`),
KEY `idx_uuid` (`uuid`),
KEY `idx_filter_report` (`datetime`,`status`),
KEY `idx_recipient` (`recipient`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `template`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `template` (
`id` bigint NOT NULL AUTO_INCREMENT,
`subject` text NOT NULL,
`name` varchar(45) NOT NULL,
`description` varchar(100) DEFAULT NULL,
`body` text NOT NULL,
`lang` varchar(45) NOT NULL,
`status` varchar(3) DEFAULT 'N',
`create_by` varchar(45) DEFAULT NULL,
`done_by` varchar(45) DEFAULT NULL,
`create_date_time` datetime DEFAULT NULL,
`lastmodify` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping routines for database 'service-email'
--
/*!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 */;
-- Dump completed on 2026-11-26 16:13:08