

CREATE TABLE `t_migration_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `unit_id` varchar(5) NOT NULL,
  `table_name` varchar(50) NOT NULL,
  `migration_date` date NOT NULL DEFAULT curdate(),
  `hour` tinyint(4) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 0,
  `fail_reason` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;




CREATE TABLE `m_unit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `unit_id` varchar(5) NOT NULL,
  `unit_name` varchar(30) DEFAULT NULL,
  `working_hours` text NOT NULL,
  `is_active` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` datetime(6) NOT NULL DEFAULT current_timestamp(6),
  `updated_at` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;



CREATE TABLE `m_line` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `line_id` varchar(10) NOT NULL,
  `line_number` varchar(10) NOT NULL,
  `line_desc` varchar(50) DEFAULT NULL,
  `db_host` varchar(30) NOT NULL,
  `db_name` varchar(20) NOT NULL,
  `db_username` varchar(30) NOT NULL,
  `db_password` varchar(20) NOT NULL,
  `db_port` int(11) NOT NULL,
  `unit_id` varchar(10) NOT NULL,
  `is_active` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` datetime(6) NOT NULL DEFAULT current_timestamp(6),
  `updated_at` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;






