SET FOREIGN_KEY_CHECKS=0;


DROP TABLE IF EXISTS `cp_classes`;
CREATE TABLE `cp_classes` (
  `class_id` int NOT NULL AUTO_INCREMENT,
  `class_name` varchar(255) NOT NULL,
  `num_classes` int NOT NULL DEFAULT '42',
  `duration_hours` decimal(4,2) NOT NULL DEFAULT '2.00',
  `note` text,
  `schedule_start_time` time DEFAULT NULL,
  `schedule_end_time` time DEFAULT NULL,
  `schedule_weekday` varchar(20) DEFAULT NULL,
  `student_name` varchar(255) DEFAULT NULL,
  `card_color` varchar(20) DEFAULT NULL,
  `display_order` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`class_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `cp_classes`(`class_id`,`class_name`,`num_classes`,`duration_hours`,`note`,`schedule_start_time`,`schedule_end_time`,`schedule_weekday`,`student_name`,`card_color`,`display_order`,`created_at`) VALUES('1','TestClass','42','2.00',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-08-09 15:13:19');

DROP TABLE IF EXISTS `cp_files`;
CREATE TABLE `cp_files` (
  `file_id` int NOT NULL AUTO_INCREMENT,
  `original_name` varchar(255) NOT NULL,
  `stored_name` varchar(255) NOT NULL,
  `file_size` bigint NOT NULL,
  `mime_type` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `ocr_text` longtext,
  PRIMARY KEY (`file_id`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


DROP TABLE IF EXISTS `system_settings`;
CREATE TABLE `system_settings` (
  `setting_id` int NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(50) NOT NULL,
  `setting_value` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`setting_id`),
  UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB AUTO_INCREMENT=1344 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `system_settings`(`setting_id`,`setting_key`,`setting_value`,`created_at`,`updated_at`) VALUES('1','version','1.0.0','2026-07-22 20:45:46','2026-07-22 20:45:46');
INSERT INTO `system_settings`(`setting_id`,`setting_key`,`setting_value`,`created_at`,`updated_at`) VALUES('2','system_code','123456','2026-07-22 20:45:46','2026-07-22 20:45:46');
INSERT INTO `system_settings`(`setting_id`,`setting_key`,`setting_value`,`created_at`,`updated_at`) VALUES('3','safe_ips','','2026-07-22 20:45:46','2026-07-22 20:45:46');
INSERT INTO `system_settings`(`setting_id`,`setting_key`,`setting_value`,`created_at`,`updated_at`) VALUES('4','google_api_key','','2026-07-22 20:45:46','2026-07-22 20:45:46');
INSERT INTO `system_settings`(`setting_id`,`setting_key`,`setting_value`,`created_at`,`updated_at`) VALUES('253','worksheet_cover_path','uploads/worksheets/cover.pdf','2026-08-09 14:29:13','2026-08-09 14:29:13');
INSERT INTO `system_settings`(`setting_id`,`setting_key`,`setting_value`,`created_at`,`updated_at`) VALUES('470','worksheet_logo_path','uploads/worksheets/logo.png','2026-08-09 14:37:00','2026-08-09 14:37:00');

SET FOREIGN_KEY_CHECKS=1;
