-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 23, 2022 at 06:40 AM
-- Server version: 10.4.22-MariaDB
-- PHP Version: 8.0.13

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `semar_production`
--

-- --------------------------------------------------------

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `admin_id` int(11) UNSIGNED NOT NULL,
  `admin_fullname` varchar(255) NOT NULL,
  `admin_email` varchar(255) NOT NULL,
  `admin_phone` varchar(255) NOT NULL,
  `admin_password` varchar(255) NOT NULL,
  `admin_allowed_login` int(1) NOT NULL DEFAULT 1,
  `admin_last_login` timestamp NULL DEFAULT NULL,
  `admin_refresh_token` varchar(255) DEFAULT NULL,
  `admin_refresh_token_expired_at` int(11) DEFAULT NULL,
  `admin_forgot_password_token` varchar(255) DEFAULT NULL,
  `admin_forgot_password_token_expired_at` int(11) DEFAULT NULL,
  `admin_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `admin_insert_admin_id` int(11) UNSIGNED NOT NULL,
  `admin_update_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  `admin_update_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `admin_delete_at` timestamp NULL DEFAULT NULL,
  `admin_delete_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `admin_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `admin_modules`
--

CREATE TABLE `admin_modules` (
  `am_id` int(11) UNSIGNED NOT NULL,
  `am_name` varchar(100) NOT NULL,
  `am_slug` varchar(100) NOT NULL,
  `am_description` varchar(255) NOT NULL,
  `am_class` varchar(50) NOT NULL,
  `am_method` varchar(50) NOT NULL,
  `am_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `am_update_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  `am_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `admin_modules`
--

INSERT INTO `admin_modules` (`am_id`, `am_name`, `am_slug`, `am_description`, `am_class`, `am_method`, `am_insert_at`, `am_update_at`, `am_active`) VALUES
(1, 'Admin Get All', 'admin-get-all', 'Admin Get All', '\\App\\Controllers\\Admin', 'getAll', '2021-07-20 08:40:39', '2022-03-04 07:58:13', 1),
(2, 'Admin Get By ID', 'admin-get-by-id', 'Admin Get By ID', '\\App\\Controllers\\Admin', 'getByID', '2021-07-20 08:40:39', '2021-07-23 15:33:13', 1),
(3, 'Admin Add', 'admin-add', 'Admin Add', '\\App\\Controllers\\Admin', 'addAdmin', '2021-07-20 08:44:28', '2021-07-23 15:33:14', 1),
(4, 'Admin Update', 'admin-update', 'Admin Update', '\\App\\Controllers\\Admin', 'updateAdmin', '2021-07-20 08:44:28', '2021-07-23 15:33:15', 1),
(5, 'Admin Delete', 'admin-delete', 'Admin Delete', '\\App\\Controllers\\Admin', 'deleteAdmin', '2021-07-20 08:44:57', '2021-09-28 05:56:09', 1),
(6, 'Admin Role Get All', 'admin-role-get-all', 'Admin Role Get All', '\\App\\Controllers\\AdminRole', 'getAll', '2021-07-20 08:44:57', '2021-07-23 15:33:18', 1),
(7, 'Admin Role Get By ID', 'admin-role-get-by-id', 'Admin Role Get By ID', '\\App\\Controllers\\AdminRole', 'getByID', '2021-07-20 08:44:57', '2021-07-23 16:10:00', 1),
(8, 'Admin Role Add', 'admin-role-add', 'Admin Role Add', '\\App\\Controllers\\AdminRole', 'addAdminRole', '2021-07-20 08:44:57', '2021-09-28 05:56:53', 1),
(9, 'Admin Role Update', 'admin-role-update', 'Admin Role Update', '\\App\\Controllers\\AdminRole', 'updateAdminRole', '2021-07-20 08:44:57', '2021-09-28 05:56:56', 1),
(10, 'Admin Role Delete', 'admin-role-delete', 'Admin Role Delete', '\\App\\Controllers\\AdminRole', 'deleteAdminRole', '2021-07-20 08:44:57', '2021-09-28 05:57:00', 1),
(11, 'Admin Module Get All', 'admin-module-get-all', 'Admin Module Get All', '\\App\\Controllers\\AdminModule', 'getAll', '2021-07-20 08:44:57', '2021-07-23 15:48:02', 1),
(12, 'Admin Module Get By ID', 'admin-module-get-by-id', 'Admin Module Get By ID', '\\App\\Controllers\\AdminModule', 'getByID', '2021-07-20 08:44:57', '2021-07-23 16:10:02', 1),
(13, 'Admin Module Add', 'admin-module-add', 'Admin Module Add', '\\App\\Controllers\\AdminModule', 'addModule', '2021-07-20 08:44:57', '2021-07-23 15:48:04', 1),
(14, 'Admin Module Update', 'admin-module-update', 'Admin Module Update', '\\App\\Controllers\\AdminModule', 'updateModule', '2021-07-20 08:44:57', '2021-07-23 15:48:05', 1),
(15, 'Admin Module Delete', 'admin-module-delete', 'Admin Module Delete', '\\App\\Controllers\\AdminModule', 'deleteModule', '2021-07-20 08:44:57', '2021-07-23 15:48:06', 1),
(16, 'Admin Role Module Get All', 'admin-role-module-get-all', 'Admin Role Module Get All', '\\App\\Controllers\\AdminRoleModule', 'getAll', '2021-07-20 08:44:57', '2021-07-23 15:48:08', 1),
(17, 'Admin Role Module Get By ID', 'admin-role-module-get-by-id', 'Admin Role Module Get By ID', '\\App\\Controllers\\AdminRoleModule', 'getByID', '2021-07-20 08:44:57', '2021-07-23 16:10:04', 1),
(18, 'Admin Role Module Get By Role ID', 'admin-role-module-get-by-role-id', 'Admin Role Module Get By Role ID', '\\App\\Controllers\\AdminRoleModule', 'getByRoleID', '2021-07-20 08:44:57', '2021-07-23 16:10:10', 1),
(19, 'Admin Role Module Add', 'admin-role-module-add', 'Admin Role Module Add', '\\App\\Controllers\\AdminRoleModule', 'addRoleModule', '2021-07-20 08:44:57', '2021-07-23 15:56:46', 1),
(20, 'Admin Role Module Add Bulk', 'admin-role-module-add-bulk', 'Admin Role Module Add Bulk', '\\App\\Controllers\\AdminRoleModule', 'addRoleModuleBulk', '2021-07-20 08:44:57', '2021-09-28 06:35:43', 1),
(21, 'Admin Role Module Update', 'admin-role-module-update', 'Admin Role Module Update', '\\App\\Controllers\\AdminRoleModule', 'updateRoleModule', '2021-07-20 08:44:57', '2021-09-28 06:35:05', 1),
(22, 'Admin Role Module Delete', 'admin-role-module-delete', 'Admin Role Module Delete', '\\App\\Controllers\\AdminRoleModule', 'deleteRoleModule', '2021-07-20 08:44:57', '2021-09-28 06:35:04', 1),
(23, 'Admin Role Permission Get All', 'admin-role-permission-get-all', 'Admin Role Permission Get All', '\\App\\Controllers\\AdminPermission', 'getAll', '2021-07-20 08:44:57', '2021-09-28 06:35:02', 1),
(24, 'Admin Role Permission Get By ID', 'admin-role-permission-get-by-id', 'Admin Role Permission Get By ID', '\\App\\Controllers\\AdminPermission', 'getByID', '2021-07-20 08:44:57', '2021-09-28 06:34:57', 1),
(25, 'Admin Role Permission Get By Admin ID', 'admin-role-permission-get-by-admin-id', 'Admin Role Permission Get By Admin ID', '\\App\\Controllers\\AdminPermission', 'getByAdminID', '2021-07-20 08:44:57', '2021-09-28 06:34:55', 1),
(26, 'Admin Role Permission Get By Role ID', 'admin-role-permission-get-by-role-id', 'Admin Role Permission Get By Role ID', '\\App\\Controllers\\AdminPermission', 'getByRoleID', '2021-07-20 08:44:57', '2021-09-28 06:34:54', 1),
(27, 'Admin Role Permission Add', 'admin-role-permission-add', 'Admin Role Permission Add', '\\App\\Controllers\\AdminPermission', 'addAdminPermission', '2021-07-20 08:44:57', '2021-12-15 08:15:07', 1),
(28, 'Admin Role Permission Update', 'admin-role-permission-update', 'Admin Role Permission Update', '\\App\\Controllers\\AdminPermission', 'updateAdminPermission', '2021-07-20 08:44:57', '2021-12-15 08:15:12', 1),
(29, 'Admin Role Permission Delete', 'admin-role-permission-delete', 'Admin Role Permission Delete', '\\App\\Controllers\\AdminPermission', 'deleteAdminPermission', '2021-07-20 08:44:57', '2021-12-15 08:15:17', 1),
(30, 'Tree Get All', 'tree-get-all', 'Tree Get All', '\\App\\Controllers\\Tree', 'getAll', '2021-07-20 08:44:57', '2022-05-14 07:00:10', 1),
(31, 'Tree Get By ID', 'tree-get-by-id', 'Tree Get By ID', '\\App\\Controllers\\Tree', 'getByID', '2021-07-20 08:44:57', '2022-05-14 07:00:10', 1),
(32, 'Tree Add', 'tree-add', 'Tree Add', '\\App\\Controllers\\Tree', 'addTree', '2021-07-20 08:44:57', '2022-05-14 07:00:20', 1),
(33, 'Tree Update', 'tree-update', 'Tree Update', '\\App\\Controllers\\Tree', 'updateTree', '2021-07-20 08:44:57', '2022-05-14 07:00:22', 1),
(34, 'Tree Delete', 'tree-delete', 'Tree Delete', '\\App\\Controllers\\Tree', 'deleteTree', '2021-07-20 08:44:57', '2022-05-14 07:00:25', 1);

-- --------------------------------------------------------

--
-- Table structure for table `admin_permissions`
--

CREATE TABLE `admin_permissions` (
  `ap_id` int(11) UNSIGNED NOT NULL,
  `ap_admin_id` int(11) UNSIGNED NOT NULL,
  `ap_role_id` int(11) UNSIGNED NOT NULL,
  `ap_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `ap_insert_admin_id` int(11) UNSIGNED NOT NULL,
  `ap_update_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  `ap_update_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `ap_delete_at` timestamp NULL DEFAULT NULL,
  `ap_delete_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `ap_active` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `admin_permissions`
--

INSERT INTO `admin_permissions` (`ap_id`, `ap_admin_id`, `ap_role_id`, `ap_insert_at`, `ap_insert_admin_id`, `ap_update_at`, `ap_update_admin_id`, `ap_delete_at`, `ap_delete_admin_id`, `ap_active`) VALUES
(1, 1, 1, '2021-07-23 09:28:02', 1, '2021-12-23 10:23:57', 1, NULL, NULL, 1);

-- --------------------------------------------------------

--
-- Table structure for table `admin_roles`
--

CREATE TABLE `admin_roles` (
  `ar_id` int(11) UNSIGNED NOT NULL,
  `ar_name` varchar(50) NOT NULL,
  `ar_slug` varchar(50) NOT NULL,
  `ar_description` varchar(255) NOT NULL,
  `ar_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `ar_insert_admin_id` int(11) UNSIGNED NOT NULL,
  `ar_update_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  `ar_update_admin_id` int(11) UNSIGNED NOT NULL,
  `ar_delete_at` timestamp NULL DEFAULT NULL,
  `ar_delete_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `ar_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `admin_roles`
--

INSERT INTO `admin_roles` (`ar_id`, `ar_name`, `ar_slug`, `ar_description`, `ar_insert_at`, `ar_insert_admin_id`, `ar_update_at`, `ar_update_admin_id`, `ar_delete_at`, `ar_delete_admin_id`, `ar_active`) VALUES
(1, 'Master Admin', 'master-admin', 'Master Admin Roles', '2021-07-23 09:27:20', 1, '2021-09-28 05:57:03', 1, NULL, NULL, 1);

-- --------------------------------------------------------

--
-- Table structure for table `admin_role_modules`
--

CREATE TABLE `admin_role_modules` (
  `arm_id` int(11) UNSIGNED NOT NULL,
  `arm_role_id` int(11) UNSIGNED NOT NULL,
  `arm_module_id` int(11) UNSIGNED NOT NULL,
  `arm_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `arm_insert_admin_id` int(11) UNSIGNED NOT NULL,
  `arm_update_at` timestamp NULL DEFAULT NULL,
  `arm_update_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `arm_delete_at` timestamp NULL DEFAULT NULL,
  `arm_delete_admin_id` int(11) UNSIGNED DEFAULT NULL,
  `arm_active` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `category_id` int(11) NOT NULL,
  `category_code` varchar(255) NOT NULL,
  `category_name` varchar(255) NOT NULL,
  `category_insert_at` timestamp NULL DEFAULT current_timestamp(),
  `category_insert_admin_id` int(11) DEFAULT NULL,
  `category_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `category_update_admin_id` int(11) DEFAULT NULL,
  `category_delete_at` timestamp NULL DEFAULT NULL,
  `category_delete_admin_id` int(11) DEFAULT NULL,
  `category_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
  `customer_id` int(11) NOT NULL,
  `customer_type` varchar(255) NOT NULL,
  `customer_code` varchar(255) NOT NULL,
  `customer_name` varchar(255) NOT NULL,
  `customer_address` varchar(255) NOT NULL,
  `customer_bank` varchar(255) NOT NULL,
  `customer_bank_account_no` varchar(255) NOT NULL,
  `customer_bank_account_name` varchar(255) NOT NULL,
  `customer_email` varchar(255) NOT NULL,
  `customer_phone` varchar(255) NOT NULL,
  `customer_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `customer_insert_admin_id` int(11) NOT NULL,
  `customer_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `customer_update_admin_id` int(11) DEFAULT NULL,
  `customer_delete_at` timestamp NULL DEFAULT NULL,
  `customer_delete_admin_id` int(11) DEFAULT NULL,
  `customer_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `gold_contents`
--

CREATE TABLE `gold_contents` (
  `gc_id` int(11) NOT NULL,
  `gc_code` varchar(25) NOT NULL,
  `gc_name` varchar(255) NOT NULL,
  `gc_multiplier` decimal(65,2) NOT NULL,
  `gc_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `gc_insert_admin_id` int(11) NOT NULL,
  `gc_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `gc_update_admin_id` int(11) DEFAULT NULL,
  `gc_delete_at` timestamp NULL DEFAULT NULL,
  `gc_delete_admin_id` int(11) DEFAULT NULL,
  `gc_active` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `gold_content_histories`
--

CREATE TABLE `gold_content_histories` (
  `gch_id` int(11) NOT NULL,
  `gch_gc_id` int(11) NOT NULL,
  `gch_multiplier_from` decimal(65,2) NOT NULL,
  `gch_multiplier_to` decimal(65,2) NOT NULL,
  `gch_description` varchar(255) NOT NULL,
  `gch_update_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `gch_update_admin_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `item_id` int(11) NOT NULL,
  `item_sku` varchar(255) NOT NULL,
  `item_name` varchar(255) NOT NULL,
  `item_workflow_id` int(11) DEFAULT NULL,
  `item_category_id` int(11) NOT NULL,
  `item_gc_id` int(11) NOT NULL,
  `item_weight` decimal(65,2) NOT NULL,
  `item_size_id` int(11) NOT NULL,
  `item_stone_type` varchar(255) NOT NULL,
  `item_use_wire` varchar(255) NOT NULL,
  `item_image_1` varchar(255) NOT NULL,
  `item_image_2` int(11) NOT NULL,
  `item_image_3` varchar(255) NOT NULL,
  `item_print_no` varchar(255) NOT NULL,
  `item_cad_file` varchar(255) NOT NULL,
  `item_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `item_insert_admin_id` int(11) NOT NULL,
  `item_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `item_update_admin_id` int(11) DEFAULT NULL,
  `item_delete_at` timestamp NULL DEFAULT NULL,
  `item_delete_admin_id` int(11) DEFAULT NULL,
  `item_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `order_id` int(11) NOT NULL,
  `order_note` varchar(255) NOT NULL,
  `order_customer_id` int(11) NOT NULL,
  `order_date` date NOT NULL,
  `order_due_date` date NOT NULL,
  `order_description` varchar(255) NOT NULL,
  `order_status` varchar(25) NOT NULL,
  `order_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `order_insert_admin_id` int(11) NOT NULL,
  `order_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `order_update_admin_id` int(11) DEFAULT NULL,
  `order_delete_at` timestamp NULL DEFAULT NULL,
  `order_delete_admin_id` int(11) DEFAULT NULL,
  `order_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `oi_id` int(11) NOT NULL,
  `oi_item_id` int(11) NOT NULL,
  `oi_date` date NOT NULL,
  `oi_start_date` date DEFAULT NULL,
  `oi_due_date` date NOT NULL,
  `oi_completed_date` date DEFAULT NULL,
  `oi_item_name` varchar(255) NOT NULL,
  `oi_gc_id` int(11) NOT NULL,
  `oi_size_id` int(11) NOT NULL,
  `oi_weight` decimal(65,2) NOT NULL,
  `oi_quantity` int(11) NOT NULL,
  `oi_description` varchar(255) NOT NULL,
  `oi_sample_note` varchar(255) NOT NULL,
  `oi_image_1` varchar(255) NOT NULL,
  `oi_image_2` varchar(255) NOT NULL,
  `oi_status` varchar(25) NOT NULL,
  `oi_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `oi_insert_admin_id` int(11) NOT NULL,
  `oi_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `oi_update_admin_id` int(11) DEFAULT NULL,
  `oi_delete_at` timestamp NULL DEFAULT NULL,
  `oi_delete_admin_id` int(11) DEFAULT NULL,
  `oi_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `sizes`
--

CREATE TABLE `sizes` (
  `size_id` int(11) NOT NULL,
  `size_code` varchar(255) NOT NULL,
  `size_name` varchar(255) NOT NULL,
  `size_insert_at` timestamp NULL DEFAULT current_timestamp(),
  `size_insert_admin_id` int(11) DEFAULT NULL,
  `size_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `size_update_admin_id` int(11) DEFAULT NULL,
  `size_delete_at` timestamp NULL DEFAULT NULL,
  `size_delete_admin_id` int(11) DEFAULT NULL,
  `size_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `task_id` int(11) NOT NULL,
  `task_code` varchar(255) NOT NULL,
  `task_name` varchar(255) NOT NULL,
  `task_input_list` varchar(255) NOT NULL,
  `task_output_list` varchar(255) NOT NULL,
  `task_input_notification_list` varchar(255) NOT NULL,
  `task_output_notification_list` varchar(255) NOT NULL,
  `task_pic_admin_id` int(11) NOT NULL,
  `task_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `task_insert_admin_id` int(11) NOT NULL,
  `task_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `task_update_admin_id` int(11) DEFAULT NULL,
  `task_delete_at` timestamp NULL DEFAULT NULL,
  `task_delete_admin_id` int(11) DEFAULT NULL,
  `task_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `trees`
--

CREATE TABLE `trees` (
  `tree_id` int(11) NOT NULL,
  `tree_code` varchar(255) NOT NULL,
  `tree_name` varchar(255) NOT NULL,
  `tree_weight` decimal(65,2) NOT NULL,
  `tree_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `tree_insert_admin_id` int(11) NOT NULL,
  `tree_update_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  `tree_update_admin_id` int(11) NOT NULL,
  `tree_delete_at` timestamp NULL DEFAULT NULL,
  `tree_delete_admin_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `tree_histories`
--

CREATE TABLE `tree_histories` (
  `th_id` int(11) NOT NULL,
  `th_tree_id` int(11) NOT NULL,
  `th_weight_from` decimal(65,2) NOT NULL,
  `th_weight_to` decimal(65,2) NOT NULL,
  `th_description` varchar(255) NOT NULL,
  `th_update_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `th_update_admin_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `workflows`
--

CREATE TABLE `workflows` (
  `workflow_id` int(11) NOT NULL,
  `workflow_code` varchar(255) NOT NULL,
  `workflow_name` varchar(255) NOT NULL,
  `workflow_insert_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `workflow_insert_admin_id` int(11) NOT NULL,
  `workflow_update_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `workflow_update_admin_id` int(11) DEFAULT NULL,
  `workflow_delete_at` timestamp NULL DEFAULT NULL,
  `workflow_delete_admin_id` int(11) DEFAULT NULL,
  `workflow_active` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `workflow_tasks`
--

CREATE TABLE `workflow_tasks` (
  `wt_id` int(11) NOT NULL,
  `wt_workflow_id` int(11) NOT NULL,
  `wt_task_id` int(11) NOT NULL,
  `wt_order` int(11) NOT NULL,
  `wt_insert_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `wt_insert_admin_id` int(11) NOT NULL,
  `wt_update_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  `wt_update_admin_id` int(11) DEFAULT NULL,
  `wt_delete_at` timestamp NULL DEFAULT NULL,
  `wt_delete_admin_id` int(11) DEFAULT NULL,
  `wt_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`admin_id`),
  ADD KEY `admin_email` (`admin_email`),
  ADD KEY `admin_fullname` (`admin_fullname`);

--
-- Indexes for table `admin_modules`
--
ALTER TABLE `admin_modules`
  ADD PRIMARY KEY (`am_id`),
  ADD KEY `am_slug` (`am_slug`),
  ADD KEY `am_class` (`am_class`),
  ADD KEY `am_method` (`am_method`);

--
-- Indexes for table `admin_permissions`
--
ALTER TABLE `admin_permissions`
  ADD PRIMARY KEY (`ap_id`),
  ADD KEY `ap_admin_id` (`ap_admin_id`),
  ADD KEY `ap_role_id` (`ap_role_id`);

--
-- Indexes for table `admin_roles`
--
ALTER TABLE `admin_roles`
  ADD PRIMARY KEY (`ar_id`),
  ADD KEY `ar_slug` (`ar_slug`);

--
-- Indexes for table `admin_role_modules`
--
ALTER TABLE `admin_role_modules`
  ADD PRIMARY KEY (`arm_id`),
  ADD KEY `arm_role_id` (`arm_role_id`),
  ADD KEY `arm_module_id` (`arm_module_id`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`category_id`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`customer_id`),
  ADD KEY `customer_code` (`customer_code`),
  ADD KEY `customer_name` (`customer_name`);

--
-- Indexes for table `gold_contents`
--
ALTER TABLE `gold_contents`
  ADD PRIMARY KEY (`gc_id`);

--
-- Indexes for table `gold_content_histories`
--
ALTER TABLE `gold_content_histories`
  ADD PRIMARY KEY (`gch_id`),
  ADD KEY `gch_gc_id` (`gch_gc_id`);

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`item_id`),
  ADD KEY `item_sku` (`item_sku`),
  ADD KEY `item_category_id` (`item_category_id`),
  ADD KEY `item_gc_id` (`item_gc_id`),
  ADD KEY `item_size_id` (`item_size_id`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`order_id`),
  ADD KEY `order_note` (`order_note`),
  ADD KEY `order_customer_id` (`order_customer_id`);

--
-- Indexes for table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`oi_id`),
  ADD KEY `oi_item_id` (`oi_item_id`),
  ADD KEY `oi_gc_id` (`oi_gc_id`),
  ADD KEY `oi_size_id` (`oi_size_id`);

--
-- Indexes for table `sizes`
--
ALTER TABLE `sizes`
  ADD PRIMARY KEY (`size_id`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`task_id`);

--
-- Indexes for table `trees`
--
ALTER TABLE `trees`
  ADD PRIMARY KEY (`tree_id`),
  ADD KEY `tree_code` (`tree_code`);

--
-- Indexes for table `tree_histories`
--
ALTER TABLE `tree_histories`
  ADD PRIMARY KEY (`th_id`),
  ADD KEY `th_tree_id` (`th_tree_id`);

--
-- Indexes for table `workflows`
--
ALTER TABLE `workflows`
  ADD PRIMARY KEY (`workflow_id`);

--
-- Indexes for table `workflow_tasks`
--
ALTER TABLE `workflow_tasks`
  ADD PRIMARY KEY (`wt_id`),
  ADD KEY `wt_workflow_id` (`wt_workflow_id`),
  ADD KEY `wt_task_id` (`wt_task_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
  MODIFY `admin_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `admin_modules`
--
ALTER TABLE `admin_modules`
  MODIFY `am_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT for table `admin_permissions`
--
ALTER TABLE `admin_permissions`
  MODIFY `ap_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `admin_roles`
--
ALTER TABLE `admin_roles`
  MODIFY `ar_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `admin_role_modules`
--
ALTER TABLE `admin_role_modules`
  MODIFY `arm_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `category_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
  MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `gold_contents`
--
ALTER TABLE `gold_contents`
  MODIFY `gc_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `gold_content_histories`
--
ALTER TABLE `gold_content_histories`
  MODIFY `gch_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
  MODIFY `item_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
  MODIFY `order_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `order_items`
--
ALTER TABLE `order_items`
  MODIFY `oi_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sizes`
--
ALTER TABLE `sizes`
  MODIFY `size_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tasks`
--
ALTER TABLE `tasks`
  MODIFY `task_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `trees`
--
ALTER TABLE `trees`
  MODIFY `tree_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tree_histories`
--
ALTER TABLE `tree_histories`
  MODIFY `th_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `workflows`
--
ALTER TABLE `workflows`
  MODIFY `workflow_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `workflow_tasks`
--
ALTER TABLE `workflow_tasks`
  MODIFY `wt_id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

/*!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 */;
