-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 03 Bulan Mei 2025 pada 07.20
-- Versi server: 8.0.30
-- Versi PHP: 8.2.25

START TRANSACTION;



--
-- Database: `db_pakar_fc_bk`
--

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

--
-- Struktur dari tabel `activity_log`
--

CREATE TABLE `activity_log` (
  `id` bigint UNSIGNED NOT NULL,
  `log_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `event` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subject_id` bigint UNSIGNED DEFAULT NULL,
  `causer_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `causer_id` bigint UNSIGNED DEFAULT NULL,
  `properties` json DEFAULT NULL,
  `batch_uuid` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `diagnoses`
--

CREATE TABLE `diagnoses` (
  `id` bigint UNSIGNED NOT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `selected_symptoms` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `education`
--

CREATE TABLE `education` (
  `id` bigint UNSIGNED NOT NULL,
  `category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `video1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `video2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `video3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `video4` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `video5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `education`
--

INSERT INTO `education` (`id`, `category`, `video1`, `video2`, `video3`, `video4`, `video5`, `created_at`, `updated_at`) VALUES
(1, 'Akademik', '1746239862_Guru BK dalam permasalahan kesulitan belajar dan nilai akademik siswanya __ Pera.mp4', NULL, NULL, NULL, NULL, '2025-05-02 19:37:42', '2025-05-02 19:37:42'),
(2, 'Sosial-Emosional', '1746240165_5 Cara Sederhana Menerapkan Social Emotion Learning di Sekolah (1).mp4', NULL, NULL, NULL, NULL, '2025-05-02 19:42:45', '2025-05-02 19:42:45'),
(3, 'Psikologis', '1746240257_Media Pembelajaran Interaktif CARA MENGATASI TRAUMA.mp4', '1746240257_STRES DAN CARA MENGATASINYA #BimbinganKonseling #BK #MateriBK.mp4', NULL, NULL, NULL, '2025-05-02 19:44:17', '2025-05-02 19:44:17'),
(4, 'Keluarga', '1746240571_KONSELING KELUARGA _ Materi Konseling.mp4', NULL, NULL, NULL, NULL, '2025-05-02 19:49:32', '2025-05-02 19:49:32');

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

--
-- Struktur dari tabel `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint UNSIGNED NOT NULL,
  `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `gejalas`
--

CREATE TABLE `gejalas` (
  `id` bigint UNSIGNED NOT NULL,
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `gejalas`
--

INSERT INTO `gejalas` (`id`, `code`, `name`, `created_at`, `updated_at`) VALUES
(1, 'G01', 'Sering bolos sekolah', '2025-05-02 19:06:23', '2025-05-02 19:06:23'),
(2, 'G02', 'Nilai akademik menurun drastis', '2025-05-02 19:06:39', '2025-05-02 19:19:28'),
(3, 'G03', 'Sering melamun di kelas', '2025-05-02 19:18:56', '2025-05-02 19:18:56'),
(4, 'G04', 'Mudah marah atau tersinggung', '2025-05-02 19:19:47', '2025-05-02 19:19:47'),
(5, 'G05', 'Menghindari interaksi sosial', '2025-05-02 19:20:03', '2025-05-02 19:20:03'),
(6, 'G06', 'Sering mengeluh sakit fisik', '2025-05-02 19:20:25', '2025-05-02 19:20:25'),
(7, 'G07', 'Terlihat cemas atau gelisah', '2025-05-02 19:20:43', '2025-05-02 19:20:43'),
(8, 'G08', 'Kurang motivasi belajar', '2025-05-02 19:21:12', '2025-05-02 19:21:12'),
(9, 'G09', 'Sering bertengkar dengan teman', '2025-05-02 19:21:47', '2025-05-02 19:21:47'),
(10, 'G10', 'Menunjukkan perilaku menyendiri', '2025-05-02 19:22:10', '2025-05-02 19:22:10');

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

--
-- Struktur dari tabel `knowlidges`
--

CREATE TABLE `knowlidges` (
  `id` bigint UNSIGNED NOT NULL,
  `gejala_id` bigint UNSIGNED DEFAULT NULL,
  `penyakit_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `knowlidges`
--

INSERT INTO `knowlidges` (`id`, `gejala_id`, `penyakit_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2025-05-02 23:04:48', '2025-05-02 23:04:48'),
(2, 1, 2, '2025-05-02 23:05:08', '2025-05-02 23:05:08'),
(3, 1, 3, '2025-05-02 23:05:20', '2025-05-02 23:05:20'),
(4, 1, 4, '2025-05-02 23:05:36', '2025-05-02 23:05:36'),
(5, 2, 1, '2025-05-02 23:05:53', '2025-05-02 23:05:53'),
(6, 2, 3, '2025-05-02 23:06:12', '2025-05-02 23:06:12'),
(7, 2, 5, '2025-05-02 23:06:50', '2025-05-02 23:06:50'),
(8, 3, 1, '2025-05-02 23:07:27', '2025-05-02 23:07:27'),
(9, 3, 3, '2025-05-02 23:08:00', '2025-05-02 23:08:00'),
(10, 3, 5, '2025-05-02 23:08:17', '2025-05-02 23:08:17'),
(11, 4, 1, '2025-05-02 23:08:45', '2025-05-02 23:08:45'),
(12, 4, 2, '2025-05-02 23:09:02', '2025-05-02 23:09:02'),
(13, 4, 4, '2025-05-02 23:09:30', '2025-05-02 23:09:30'),
(14, 5, 2, '2025-05-02 23:10:05', '2025-05-02 23:10:05'),
(15, 5, 3, '2025-05-02 23:10:18', '2025-05-02 23:10:18'),
(16, 5, 5, '2025-05-02 23:10:30', '2025-05-02 23:10:30'),
(17, 6, 1, '2025-05-02 23:10:51', '2025-05-02 23:10:51'),
(18, 6, 3, '2025-05-02 23:11:03', '2025-05-02 23:11:03'),
(19, 6, 5, '2025-05-02 23:11:19', '2025-05-02 23:11:19'),
(20, 7, 1, '2025-05-02 23:12:00', '2025-05-02 23:12:00'),
(21, 7, 5, '2025-05-02 23:12:18', '2025-05-02 23:12:18'),
(22, 8, 1, '2025-05-02 23:13:08', '2025-05-02 23:13:08'),
(23, 8, 3, '2025-05-02 23:13:19', '2025-05-02 23:13:19'),
(24, 9, 2, '2025-05-02 23:13:40', '2025-05-02 23:13:40'),
(25, 9, 4, '2025-05-02 23:13:55', '2025-05-02 23:13:55'),
(26, 10, 2, '2025-05-02 23:14:57', '2025-05-02 23:14:57'),
(27, 10, 3, '2025-05-02 23:15:12', '2025-05-02 23:15:12'),
(28, 10, 5, '2025-05-02 23:15:38', '2025-05-02 23:15:38');

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

--
-- Struktur dari tabel `migrations`
--

CREATE TABLE `migrations` (
  `id` int UNSIGNED NOT NULL,
  `migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2023_09_10_171611_create_gejalas_table', 1),
(6, '2023_09_10_171630_create_penyakit_table', 1),
(7, '2023_09_10_171709_create_knowlidges_table', 1),
(8, '2023_09_20_181250_create_diagnoses_table', 1),
(9, '2023_09_21_194728_create_rule_table', 1),
(10, '2023_09_28_091256_create_education_table', 1),
(11, '2023_10_13_191733_create_activity_log_table', 1),
(12, '2023_10_13_191734_add_event_column_to_activity_log_table', 1),
(13, '2023_10_13_191735_add_batch_uuid_column_to_activity_log_table', 1);

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

--
-- Struktur dari tabel `penyakit`
--

CREATE TABLE `penyakit` (
  `id` bigint UNSIGNED NOT NULL,
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `education_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `penyakit`
--

INSERT INTO `penyakit` (`id`, `code`, `name`, `description`, `education_id`, `created_at`, `updated_at`) VALUES
(1, 'M01', 'Stress Akademik', 'Konseling manajemen waktu, teknik relaksasi, kolaborasi dengan guru', NULL, '2025-05-02 20:20:43', '2025-05-02 20:20:43'),
(2, 'M02', 'Bullying', 'Mediasi, program anti-bullying, pendampingan psikologis', NULL, '2025-05-02 20:21:31', '2025-05-02 20:21:31'),
(3, 'M03', 'Depresi Ringan', 'Terapi kognitif, rujukan ke psikolog/psikiater', NULL, '2025-05-02 20:22:24', '2025-05-02 20:22:24'),
(4, 'M04', 'Konflik Keluarga', 'Family counseling, komunikasi assertif', NULL, '2025-05-02 20:23:04', '2025-05-02 20:23:04'),
(5, 'M05', 'Gangguan Kecemasan', 'Latihan pernapasan, terapi eksposur (jika diperlukan)', NULL, '2025-05-02 20:23:43', '2025-05-02 20:23:43');

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

--
-- Struktur dari tabel `rule`
--

CREATE TABLE `rule` (
  `id` bigint UNSIGNED NOT NULL,
  `gejala_id` bigint UNSIGNED NOT NULL,
  `penyakit_id` bigint UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `activity_log`
--
ALTER TABLE `activity_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subject` (`subject_type`,`subject_id`),
  ADD KEY `causer` (`causer_type`,`causer_id`),
  ADD KEY `activity_log_log_name_index` (`log_name`);

--
-- Indeks untuk tabel `diagnoses`
--
ALTER TABLE `diagnoses`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `education`
--
ALTER TABLE `education`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indeks untuk tabel `gejalas`
--
ALTER TABLE `gejalas`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `knowlidges`
--
ALTER TABLE `knowlidges`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `knowlidges_gejala_id_kerusakan_id_unique` (`gejala_id`,`penyakit_id`),
  ADD KEY `knowlidges_kerusakan_id_foreign` (`penyakit_id`);

--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `penyakit`
--
ALTER TABLE `penyakit`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `rule`
--
ALTER TABLE `rule`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rule_gejala_id_kerusakan_id_unique` (`gejala_id`,`penyakit_id`),
  ADD KEY `rule_kerusakan_id_foreign` (`penyakit_id`);

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

--
-- AUTO_INCREMENT untuk tabel `activity_log`
--
ALTER TABLE `activity_log`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `diagnoses`
--
ALTER TABLE `diagnoses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `education`
--
ALTER TABLE `education`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `gejalas`
--
ALTER TABLE `gejalas`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT untuk tabel `knowlidges`
--
ALTER TABLE `knowlidges`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT untuk tabel `penyakit`
--
ALTER TABLE `penyakit`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT untuk tabel `rule`
--
ALTER TABLE `rule`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--

--
-- Ketidakleluasaan untuk tabel `knowlidges`
--
ALTER TABLE `knowlidges`
  ADD CONSTRAINT `knowlidges_gejala_id_foreign` FOREIGN KEY (`gejala_id`) REFERENCES `gejalas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `knowlidges_kerusakan_id_foreign` FOREIGN KEY (`penyakit_id`) REFERENCES `penyakit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Ketidakleluasaan untuk tabel `rule`
--
ALTER TABLE `rule`
  ADD CONSTRAINT `rule_gejala_id_foreign` FOREIGN KEY (`gejala_id`) REFERENCES `gejalas` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `rule_kerusakan_id_foreign` FOREIGN KEY (`penyakit_id`) REFERENCES `penyakit` (`id`) ON DELETE CASCADE;
COMMIT;

