CREATE DATABASE IF NOT EXISTS `ord_db`
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

USE `ord_db`;

CREATE TABLE IF NOT EXISTS `orders` (
  `id` varchar(64) NOT NULL,
  `order_no` varchar(64) DEFAULT NULL,
  `order_date` date DEFAULT NULL,
  `client_name` varchar(255) DEFAULT NULL,
  `brand_name` varchar(255) DEFAULT NULL,
  `perfume_name` varchar(255) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `progress_percent` int NOT NULL DEFAULT 0,
  `updated_at` datetime NOT NULL,
  `data_json` longtext NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_order_no` (`order_no`),
  KEY `idx_order_date` (`order_date`),
  KEY `idx_client_name` (`client_name`),
  KEY `idx_updated_at` (`updated_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
