--
-- Host: localhost    Database: e_ujian
-- ------------------------------------------------------


--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--


--
-- Table structure for table `guru`
--

CREATE TABLE `guru` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `nip` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `jenis_kelamin` enum('L','P') COLLATE utf8mb4_unicode_ci NOT NULL,
  `no_hp` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `foto` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `guru_nip_unique` (`nip`),
  KEY `guru_user_id_index` (`user_id`),
  CONSTRAINT `guru_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `guru`
--


--
-- Table structure for table `guru_mengajar`
--

CREATE TABLE `guru_mengajar` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `guru_id` bigint unsigned NOT NULL,
  `mata_pelajaran_id` bigint unsigned NOT NULL,
  `kelas_id` bigint unsigned NOT NULL,
  `tahun_ajaran_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `guru_mengajar_unique` (`guru_id`,`mata_pelajaran_id`,`kelas_id`,`tahun_ajaran_id`),
  KEY `guru_mengajar_guru_id_index` (`guru_id`),
  KEY `guru_mengajar_mata_pelajaran_id_index` (`mata_pelajaran_id`),
  KEY `guru_mengajar_kelas_id_index` (`kelas_id`),
  KEY `guru_mengajar_tahun_ajaran_id_index` (`tahun_ajaran_id`),
  CONSTRAINT `guru_mengajar_guru_id_foreign` FOREIGN KEY (`guru_id`) REFERENCES `guru` (`id`) ON DELETE CASCADE,
  CONSTRAINT `guru_mengajar_kelas_id_foreign` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  CONSTRAINT `guru_mengajar_mata_pelajaran_id_foreign` FOREIGN KEY (`mata_pelajaran_id`) REFERENCES `mata_pelajaran` (`id`) ON DELETE CASCADE,
  CONSTRAINT `guru_mengajar_tahun_ajaran_id_foreign` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `guru_mengajar`
--


--
-- Table structure for table `jadwal_ujian`
--

CREATE TABLE `jadwal_ujian` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `tahun_ajaran_id` bigint unsigned NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_mulai` date NOT NULL,
  `tanggal_selesai` date NOT NULL,
  `jenis_ujian` enum('PAS','UM','PTS','PH') COLLATE utf8mb4_unicode_ci NOT NULL,
  `waktu_mulai` time NOT NULL,
  `waktu_selesai` time NOT NULL,
  `durasi_menit` int NOT NULL DEFAULT '90',
  `keterangan` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `jadwal_ujian_tahun_ajaran_id_index` (`tahun_ajaran_id`),
  KEY `jadwal_ujian_tanggal_mulai_index` (`tanggal_mulai`),
  CONSTRAINT `jadwal_ujian_tahun_ajaran_id_foreign` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `jadwal_ujian`
--


--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_jobs` int NOT NULL,
  `pending_jobs` int NOT NULL,
  `failed_jobs` int NOT NULL,
  `failed_job_ids` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `options` mediumtext COLLATE utf8mb4_unicode_ci,
  `cancelled_at` int DEFAULT NULL,
  `created_at` int NOT NULL,
  `finished_at` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `job_batches`
--


--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` tinyint unsigned NOT NULL,
  `reserved_at` int unsigned DEFAULT NULL,
  `available_at` int unsigned NOT NULL,
  `created_at` int unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `jobs`
--


--
-- Table structure for table `kelas`
--

CREATE TABLE `kelas` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `tahun_ajaran_id` bigint unsigned NOT NULL,
  `tingkat_sekolah_id` bigint unsigned NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tingkat` int NOT NULL,
  `jumlah_siswa` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `kelas_tahun_ajaran_id_index` (`tahun_ajaran_id`),
  KEY `kelas_tingkat_sekolah_id_index` (`tingkat_sekolah_id`),
  CONSTRAINT `kelas_tahun_ajaran_id_foreign` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE,
  CONSTRAINT `kelas_tingkat_sekolah_id_foreign` FOREIGN KEY (`tingkat_sekolah_id`) REFERENCES `tingkat_sekolah` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `kelas`
--

INSERT INTO `kelas` VALUES (1,1,2,'VII-A',7,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(2,1,2,'VII-B',7,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(3,1,2,'VII-C',7,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(4,1,2,'VIII-A',8,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(5,1,2,'VIII-B',8,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(6,1,2,'IX-A',9,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(7,1,2,'IX-B',9,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(8,1,2,'IX-C',9,0,'2026-04-04 09:44:37','2026-04-04 09:44:37'),(9,1,2,'IX-D',9,0,'2026-04-04 09:44:37','2026-04-04 09:44:37');

--
-- Table structure for table `mata_pelajaran`
--

CREATE TABLE `mata_pelajaran` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `tingkat_sekolah_id` bigint unsigned NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kode` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `mata_pelajaran_tingkat_sekolah_id_index` (`tingkat_sekolah_id`),
  CONSTRAINT `mata_pelajaran_tingkat_sekolah_id_foreign` FOREIGN KEY (`tingkat_sekolah_id`) REFERENCES `tingkat_sekolah` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mata_pelajaran`
--

INSERT INTO `mata_pelajaran` VALUES (1,2,'Matematika','MTK','2026-04-04 09:44:37','2026-04-04 09:44:37'),(2,2,'Bahasa Indonesia','BIND','2026-04-04 09:44:37','2026-04-04 09:44:37'),(3,2,'Bahasa Inggris','BING','2026-04-04 09:44:37','2026-04-04 09:44:37'),(4,2,'IPA','IPA','2026-04-04 09:44:37','2026-04-04 09:44:37'),(5,2,'IPS','IPS','2026-04-04 09:44:37','2026-04-04 09:44:37'),(6,2,'Pendidikan Agama Islam','PAI','2026-04-04 09:44:37','2026-04-04 09:44:37'),(7,2,'PKn','PKN','2026-04-04 09:44:37','2026-04-04 09:44:37'),(8,2,'Bahasa Arab','BARAB','2026-04-04 09:44:37','2026-04-04 09:44:37'),(9,2,'Fikih','FQH','2026-04-04 09:44:37','2026-04-04 09:44:37'),(10,2,'Akidah Akhlak','AA','2026-04-04 09:44:37','2026-04-04 09:44:37');

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES (1,'0001_01_01_000000_create_users_table',1),(2,'0001_01_01_000001_create_cache_table',1),(3,'0001_01_01_000002_create_jobs_table',1),(4,'2024_01_01_000001_create_tahun_ajaran_table',1),(5,'2024_01_01_000002_create_tingkat_sekolah_table',1),(6,'2024_01_01_000003_create_kelas_table',1),(7,'2024_01_01_000004_create_mata_pelajaran_table',1),(8,'2024_01_01_000005_create_guru_table',1),(9,'2024_01_01_000006_create_siswa_table',1),(10,'2024_01_01_000007_create_guru_mengajar_table',1),(11,'2024_01_01_000008_create_ujian_table',1),(12,'2024_01_01_000009_create_jadwal_ujian_table',1),(13,'2024_01_01_000010_create_pengerjaan_ujian_table',1),(14,'2024_01_01_000011_create_pelanggaran_ujian_table',1),(15,'2024_01_01_000012_create_nilai_ujian_table',1),(16,'2024_01_01_000013_create_setting_katrol_table',1),(17,'2026_04_02_035117_create_personal_access_tokens_table',1),(18,'2026_04_03_000001_alter_jadwal_ujian_table',1);

--
-- Table structure for table `nilai_ujian`
--

CREATE TABLE `nilai_ujian` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `ujian_id` bigint unsigned NOT NULL,
  `siswa_id` bigint unsigned NOT NULL,
  `nilai_pg` decimal(5,2) DEFAULT NULL,
  `nilai_bs` decimal(5,2) DEFAULT NULL,
  `nilai_essay` decimal(5,2) DEFAULT NULL,
  `nilai_murni` decimal(5,2) DEFAULT NULL,
  `nilai_katrol` decimal(5,2) DEFAULT NULL,
  `nilai_final` decimal(5,2) DEFAULT NULL,
  `is_uploaded` tinyint(1) NOT NULL DEFAULT '0',
  `is_essay_filled` tinyint(1) NOT NULL DEFAULT '0',
  `is_katrol` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `nilai_ujian_ujian_id_siswa_id_unique` (`ujian_id`,`siswa_id`),
  KEY `nilai_ujian_ujian_id_index` (`ujian_id`),
  KEY `nilai_ujian_siswa_id_index` (`siswa_id`),
  CONSTRAINT `nilai_ujian_siswa_id_foreign` FOREIGN KEY (`siswa_id`) REFERENCES `siswa` (`id`) ON DELETE CASCADE,
  CONSTRAINT `nilai_ujian_ujian_id_foreign` FOREIGN KEY (`ujian_id`) REFERENCES `ujian` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `nilai_ujian`
--


--
-- Table structure for table `pelanggaran_ujian`
--

CREATE TABLE `pelanggaran_ujian` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `pengerjaan_ujian_id` bigint unsigned NOT NULL,
  `jenis` enum('klik_kanan','pindah_tab','buka_tab_baru','keluar_fullscreen','shortcut_terlarang') COLLATE utf8mb4_unicode_ci NOT NULL,
  `waktu` timestamp NOT NULL,
  `keterangan` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pelanggaran_ujian_pengerjaan_ujian_id_index` (`pengerjaan_ujian_id`),
  CONSTRAINT `pelanggaran_ujian_pengerjaan_ujian_id_foreign` FOREIGN KEY (`pengerjaan_ujian_id`) REFERENCES `pengerjaan_ujian` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `pelanggaran_ujian`
--


--
-- Table structure for table `pengerjaan_ujian`
--

CREATE TABLE `pengerjaan_ujian` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `ujian_id` bigint unsigned NOT NULL,
  `siswa_id` bigint unsigned NOT NULL,
  `waktu_mulai` timestamp NULL DEFAULT NULL,
  `waktu_selesai` timestamp NULL DEFAULT NULL,
  `status` enum('belum','sedang','selesai','direset') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'belum',
  `jumlah_pelanggaran` int NOT NULL DEFAULT '0',
  `is_locked` tinyint(1) NOT NULL DEFAULT '0',
  `catatan_reset` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `pengerjaan_ujian_ujian_id_siswa_id_unique` (`ujian_id`,`siswa_id`),
  KEY `pengerjaan_ujian_ujian_id_index` (`ujian_id`),
  KEY `pengerjaan_ujian_siswa_id_index` (`siswa_id`),
  KEY `pengerjaan_ujian_status_index` (`status`),
  CONSTRAINT `pengerjaan_ujian_siswa_id_foreign` FOREIGN KEY (`siswa_id`) REFERENCES `siswa` (`id`) ON DELETE CASCADE,
  CONSTRAINT `pengerjaan_ujian_ujian_id_foreign` FOREIGN KEY (`ujian_id`) REFERENCES `ujian` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `pengerjaan_ujian`
--


--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--


--
-- Table structure for table `setting_katrol`
--

CREATE TABLE `setting_katrol` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `ujian_id` bigint unsigned NOT NULL,
  `guru_mengajar_id` bigint unsigned NOT NULL,
  `kkm` decimal(5,2) NOT NULL DEFAULT '75.00',
  `nilai_minimum_raport` decimal(5,2) NOT NULL DEFAULT '75.00',
  `nilai_maximum_raport` decimal(5,2) NOT NULL DEFAULT '90.00',
  `is_applied` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `setting_katrol_ujian_id_unique` (`ujian_id`),
  KEY `setting_katrol_guru_mengajar_id_index` (`guru_mengajar_id`),
  CONSTRAINT `setting_katrol_guru_mengajar_id_foreign` FOREIGN KEY (`guru_mengajar_id`) REFERENCES `guru_mengajar` (`id`) ON DELETE CASCADE,
  CONSTRAINT `setting_katrol_ujian_id_foreign` FOREIGN KEY (`ujian_id`) REFERENCES `ujian` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `setting_katrol`
--


--
-- Table structure for table `siswa`
--

CREATE TABLE `siswa` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `kelas_id` bigint unsigned DEFAULT NULL,
  `nis` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nisn` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `jenis_kelamin` enum('L','P') COLLATE utf8mb4_unicode_ci NOT NULL,
  `no_hp` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `foto` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `siswa_nis_unique` (`nis`),
  UNIQUE KEY `siswa_nisn_unique` (`nisn`),
  KEY `siswa_user_id_index` (`user_id`),
  KEY `siswa_kelas_id_index` (`kelas_id`),
  CONSTRAINT `siswa_kelas_id_foreign` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE SET NULL,
  CONSTRAINT `siswa_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `siswa`
--


--
-- Table structure for table `tahun_ajaran`
--

CREATE TABLE `tahun_ajaran` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `semester` enum('1','2') COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_mulai` date NOT NULL,
  `tanggal_selesai` date NOT NULL,
  `is_aktif` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tahun_ajaran_is_aktif_index` (`is_aktif`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tahun_ajaran`
--

INSERT INTO `tahun_ajaran` VALUES (1,'2024/2025','1','2024-07-15','2024-12-20',1,'2026-04-04 09:44:36','2026-04-04 09:44:36');

--
-- Table structure for table `tingkat_sekolah`
--

CREATE TABLE `tingkat_sekolah` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `urutan` int NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tingkat_sekolah`
--

INSERT INTO `tingkat_sekolah` VALUES (1,'MI','mi',1,'2026-04-04 09:44:36','2026-04-04 09:44:36'),(2,'MTs','mts',2,'2026-04-04 09:44:36','2026-04-04 09:44:36'),(3,'MA','ma',3,'2026-04-04 09:44:36','2026-04-04 09:44:36');

--
-- Table structure for table `ujian`
--

CREATE TABLE `ujian` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `tahun_ajaran_id` bigint unsigned NOT NULL,
  `mata_pelajaran_id` bigint unsigned NOT NULL,
  `kelas_id` bigint unsigned NOT NULL,
  `guru_mengajar_id` bigint unsigned NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `jenis` enum('PAS','UM','PTS','PH') COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_mulai` date NOT NULL,
  `tanggal_selesai` date NOT NULL,
  `waktu_mulai` time NOT NULL,
  `waktu_selesai` time NOT NULL,
  `durasi_menit` int NOT NULL DEFAULT '90',
  `link_google_form` text COLLATE utf8mb4_unicode_ci,
  `link_google_form_template` text COLLATE utf8mb4_unicode_ci,
  `status` enum('draft','aktif','selesai') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `keterangan` text COLLATE utf8mb4_unicode_ci,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `ujian_mata_pelajaran_id_foreign` (`mata_pelajaran_id`),
  KEY `ujian_guru_mengajar_id_foreign` (`guru_mengajar_id`),
  KEY `ujian_tahun_ajaran_id_index` (`tahun_ajaran_id`),
  KEY `ujian_jenis_index` (`jenis`),
  KEY `ujian_status_index` (`status`),
  KEY `ujian_kelas_id_index` (`kelas_id`),
  KEY `ujian_tanggal_mulai_index` (`tanggal_mulai`),
  CONSTRAINT `ujian_guru_mengajar_id_foreign` FOREIGN KEY (`guru_mengajar_id`) REFERENCES `guru_mengajar` (`id`) ON DELETE CASCADE,
  CONSTRAINT `ujian_kelas_id_foreign` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  CONSTRAINT `ujian_mata_pelajaran_id_foreign` FOREIGN KEY (`mata_pelajaran_id`) REFERENCES `mata_pelajaran` (`id`) ON DELETE CASCADE,
  CONSTRAINT `ujian_tahun_ajaran_id_foreign` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ujian`
--



