-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `jisc`
--

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

--
-- Table structure for table `anecdote`
--

CREATE TABLE `anecdote` (
  `id` int NOT NULL,
  `pengirim_tipe` enum('Guru','Perpustakaan','Sistem','Admin') COLLATE utf8mb4_unicode_ci NOT NULL,
  `pengirim_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pengirim_nama` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tipe_pesan` enum('Informasi','Peringatan','Tugas','Prestasi') COLLATE utf8mb4_unicode_ci DEFAULT 'Informasi',
  `target_jenis` enum('Semua','Perorangan','Kelas') COLLATE utf8mb4_unicode_ci DEFAULT 'Semua',
  `target_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `isi_pesan` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_kirim` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `status_dibaca` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `anecdote`
--

INSERT INTO `anecdote` (`id`, `pengirim_tipe`, `pengirim_id`, `pengirim_nama`, `tipe_pesan`, `target_jenis`, `target_id`, `isi_pesan`, `tanggal_kirim`, `status_dibaca`) VALUES
(1, 'Guru', '0987654321234567', 'siti anisa', 'Peringatan', 'Perorangan', '1234567890', 'test', '2026-08-01 18:10:46', 0),
(2, 'Guru', '0987654321234567', 'siti anisa', 'Prestasi', 'Perorangan', '1234567890', 'test2', '2026-08-01 19:04:58', 0),
(3, 'Guru', '0987654321234567', 'siti anisa', 'Peringatan', 'Perorangan', '1234567890', 'test3', '2026-08-01 19:48:20', 0);

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

--
-- Table structure for table `elearning_aktivitas`
--

CREATE TABLE `elearning_aktivitas` (
  `id` int NOT NULL,
  `nuptk_guru` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `tanggal` date DEFAULT NULL,
  `badge` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `icon` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `warna_icon` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_balasan_diskusi`
--

CREATE TABLE `elearning_balasan_diskusi` (
  `id` int NOT NULL,
  `id_diskusi` int NOT NULL,
  `isi` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `pembalas_tipe` enum('Guru','Siswa') COLLATE utf8mb4_unicode_ci DEFAULT 'Guru',
  `pembalas_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `pembalas_nama` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `waktu` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_diskusi`
--

CREATE TABLE `elearning_diskusi` (
  `id` int NOT NULL,
  `id_pertemuan` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `isi` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `pembuat_tipe` enum('Guru','Siswa') COLLATE utf8mb4_unicode_ci DEFAULT 'Guru',
  `pembuat_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `pembuat_nama` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `waktu` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_jawaban_quiz`
--

CREATE TABLE `elearning_jawaban_quiz` (
  `id` int NOT NULL,
  `id_quiz` int NOT NULL,
  `nis_siswa` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `teks_jawaban` text COLLATE utf8mb4_unicode_ci,
  `file_jawaban_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `waktu_kirim` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `balasan_nilai_guru` text COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_modul`
--

CREATE TABLE `elearning_modul` (
  `id` int NOT NULL,
  `id_pertemuan` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `file_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_pertemuan`
--

CREATE TABLE `elearning_pertemuan` (
  `id` int NOT NULL,
  `id_aktivitas` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `waktu` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_quiz`
--

CREATE TABLE `elearning_quiz` (
  `id` int NOT NULL,
  `id_pertemuan` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tipe` enum('Quiz','Tugas') COLLATE utf8mb4_unicode_ci DEFAULT 'Quiz',
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `soal` longtext COLLATE utf8mb4_unicode_ci,
  `deadline` datetime DEFAULT NULL,
  `file_lampiran_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `elearning_video`
--

CREATE TABLE `elearning_video` (
  `id` int NOT NULL,
  `id_pertemuan` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `link_video` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `durasi` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `guru` (
  `nuptk` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_lengkap` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mapel` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '-',
  `email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT '-',
  `jabatan` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT 'Tenaga Pendidik',
  `tanggal_bergabung` date DEFAULT NULL,
  `foto_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `guru` (`nuptk`, `nama_lengkap`, `mapel`, `email`, `jabatan`, `tanggal_bergabung`, `foto_url`, `created_at`) VALUES
('0987654321234567', 'siti anisa', 'indonesia', 'siti@gmail.com', 'Tenaga Pendidik', NULL, NULL, '2026-07-31 03:44:11');

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

--
-- Table structure for table `info_berita`
--

CREATE TABLE `info_berita` (
  `id` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `konten` longtext COLLATE utf8mb4_unicode_ci,
  `gambar_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tanggal` date DEFAULT NULL,
  `status` enum('Published','Draft') COLLATE utf8mb4_unicode_ci DEFAULT 'Draft',
  `link_luar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `teks_tombol_link` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `jumlah_dilihat` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `info_galeri_album`
--

CREATE TABLE `info_galeri_album` (
  `id` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kategori` enum('Kegiatan','Fasilitas','Prestasi') COLLATE utf8mb4_unicode_ci DEFAULT 'Kegiatan',
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `tanggal_dibuat` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `info_galeri_item`
--

CREATE TABLE `info_galeri_item` (
  `id` int NOT NULL,
  `id_album` int NOT NULL,
  `tipe` enum('image','video') COLLATE utf8mb4_unicode_ci DEFAULT 'image',
  `file_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `keterangan` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `info_kontak`
--

CREATE TABLE `info_kontak` (
  `id` int NOT NULL DEFAULT '1',
  `alamat` text COLLATE utf8mb4_unicode_ci,
  `telepon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `jam_operasional` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `info_kontak`
--

INSERT INTO `info_kontak` (`id`, `alamat`, `telepon`, `email`, `jam_operasional`, `updated_at`) VALUES
(1, 'Jl. Pendidikan No. 123, Kota', '081234567890', 'info@jisc.com', 'Senin-Jumat: 07:00 - 16:00', '2026-08-01 13:35:51');

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

--
-- Table structure for table `info_pesan`
--

CREATE TABLE `info_pesan` (
  `id` int NOT NULL,
  `nama` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pesan` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` enum('Baru','Dibaca') COLLATE utf8mb4_unicode_ci DEFAULT 'Baru',
  `tanggal` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `info_profil`
--

CREATE TABLE `info_profil` (
  `id` int NOT NULL DEFAULT '1',
  `sejarah` longtext COLLATE utf8mb4_unicode_ci,
  `gambar_sejarah` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `visi` longtext COLLATE utf8mb4_unicode_ci,
  `misi` longtext COLLATE utf8mb4_unicode_ci,
  `npsn` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tahun_berdiri` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `akreditasi` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nilai_akreditasi` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status_sekolah` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `info_profil`
--

INSERT INTO `info_profil` (`id`, `sejarah`, `gambar_sejarah`, `visi`, `misi`, `npsn`, `tahun_berdiri`, `akreditasi`, `nilai_akreditasi`, `status_sekolah`, `updated_at`) VALUES
(1, 'Sejarah sekolah JISC...', NULL, 'Visi sekolah JISC...', 'Misi sekolah JISC...', '12345678', '2000', 'A', '95', 'Swasta', '2026-08-01 13:35:51');

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

--
-- Table structure for table `info_slider`
--

CREATE TABLE `info_slider` (
  `id` int NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `gambar_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `urutan` int DEFAULT '0',
  `status` enum('aktif','nonaktif') COLLATE utf8mb4_unicode_ci DEFAULT 'aktif',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `info_sosmed`
--

CREATE TABLE `info_sosmed` (
  `id` int NOT NULL,
  `platform` enum('facebook','instagram','youtube','twitter') COLLATE utf8mb4_unicode_ci NOT NULL,
  `link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `inventaris_barang`
--

CREATE TABLE `inventaris_barang` (
  `id` int NOT NULL,
  `id_ruangan` int NOT NULL,
  `kode_barang` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_barang` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kondisi` enum('Baik','Rusak Ringan','Rusak Berat') COLLATE utf8mb4_unicode_ci DEFAULT 'Baik',
  `harga` decimal(15,2) DEFAULT '0.00',
  `tahun_perolehan` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `jadwal_mengajar`
--

CREATE TABLE `jadwal_mengajar` (
  `id` int NOT NULL,
  `nuptk_guru` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_kelas` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `hari` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `jam` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mapel` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ruang` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tahun_ajaran` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '2024/2025',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `kelas` (
  `id_kelas` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_kelas` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tingkat` enum('Nursery','TK A','TK B','K1','K2','K3') COLLATE utf8mb4_unicode_ci DEFAULT 'TK A',
  `nuptk_wali_kelas` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tahun_ajaran` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '2024/2025',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `kelas` (`id_kelas`, `nama_kelas`, `tingkat`, `nuptk_wali_kelas`, `tahun_ajaran`, `created_at`) VALUES
('KLS_1785489957668', 'K1A', 'TK A', '0987654321234567', '2024/2025', '2026-07-31 09:25:57');

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

--
-- Table structure for table `laporan_kerusakan`
--

CREATE TABLE `laporan_kerusakan` (
  `id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_pelapor` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `jabatan_pelapor` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telp_pelapor` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email_pelapor` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `id_barang` int DEFAULT NULL,
  `nama_barang` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kode_barang` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ruangan` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deskripsi_kerusakan` text COLLATE utf8mb4_unicode_ci,
  `status` enum('pending','proses','selesai','ditolak') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `catatan_admin` text COLLATE utf8mb4_unicode_ci,
  `tanggal_lapor` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `perpus_buku`
--

CREATE TABLE `perpus_buku` (
  `kode_buku` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `judul` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kategori` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `penerbit` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sinopsis` text COLLATE utf8mb4_unicode_ci,
  `stok_total` int DEFAULT '1',
  `stok_tersedia` int DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `perpus_peminjaman`
--

CREATE TABLE `perpus_peminjaman` (
  `id_transaksi` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nis_siswa` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kode_buku` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tanggal_pinjam` date DEFAULT NULL,
  `batas_kembali` date DEFAULT NULL,
  `tanggal_kembali` date DEFAULT NULL,
  `status` enum('dipinjam','terlambat','dikembalikan') COLLATE utf8mb4_unicode_ci DEFAULT 'dipinjam',
  `denda` int DEFAULT '0',
  `kondisi_saat_kembali` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `perpus_pengaturan`
--

CREATE TABLE `perpus_pengaturan` (
  `id` int NOT NULL DEFAULT '1',
  `denda_per_hari` int DEFAULT '1000',
  `maks_pinjam` int DEFAULT '3'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `perpus_pengaturan`
--

INSERT INTO `perpus_pengaturan` (`id`, `denda_per_hari`, `maks_pinjam`) VALUES
(1, 1000, 3);

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

--
-- Table structure for table `prestasi`
--

CREATE TABLE `prestasi` (
  `id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kategori` enum('Siswa','Guru','Sekolah') COLLATE utf8mb4_unicode_ci DEFAULT 'Siswa',
  `id_penerima` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nama_penerima` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kegiatan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `penghargaan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tingkat` enum('Sekolah','Kecamatan','Kota','Provinsi','Nasional','Internasional') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tanggal` date DEFAULT NULL,
  `file_bukti_url` longtext COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `psb_pendaftar`
--

CREATE TABLE `psb_pendaftar` (
  `id` int NOT NULL,
  `nama_anak` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `level` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tanggal_lahir` date DEFAULT NULL,
  `jenis_kelamin` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sekolah_asal` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nama_ortu` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alamat` text COLLATE utf8mb4_unicode_ci,
  `telepon` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sumber_info` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('pending','interview','approved','rejected') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `file_bukti_bayar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_akta_lahir` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_kk` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_ktp_ortu` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_form_wawancara` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_foto` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `psb_settings`
--

CREATE TABLE `psb_settings` (
  `id` int NOT NULL DEFAULT '1',
  `nomor_wa_admin` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `template_pesan` text COLLATE utf8mb4_unicode_ci,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `psb_settings`
--

INSERT INTO `psb_settings` (`id`, `nomor_wa_admin`, `template_pesan`, `updated_at`) VALUES
(1, '6281234567890', 'Assalamu\'alaikum {nama}...', '2026-08-01 13:35:51');

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

--
-- Table structure for table `psb_wa_log`
--

CREATE TABLE `psb_wa_log` (
  `id` int NOT NULL,
  `id_pendaftar` int DEFAULT NULL,
  `jenis_aksi` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nomor_tujuan` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `isi_pesan` text COLLATE utf8mb4_unicode_ci,
  `waktu_kirim` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `raport_isi`
--

CREATE TABLE `raport_isi` (
  `id` int NOT NULL,
  `nis_siswa` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nuptk_guru` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_template` int NOT NULL,
  `semester` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tahun_ajaran` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `data_isian` longtext COLLATE utf8mb4_unicode_ci,
  `tanggal_isi` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `raport_kirim`
--

CREATE TABLE `raport_kirim` (
  `id` int NOT NULL,
  `id_template` int NOT NULL,
  `nuptk_guru_tujuan` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `id_kelas` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `semester` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tahun_ajaran` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pesan` text COLLATE utf8mb4_unicode_ci,
  `status` enum('pending','dikirim','dibaca') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `tanggal_kirim` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `nis_siswa` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `raport_template`
--

CREATE TABLE `raport_template` (
  `id` int NOT NULL,
  `nama_template` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `path_file` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_upload` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `ruangan`
--

CREATE TABLE `ruangan` (
  `id_ruangan` int NOT NULL,
  `nama_ruangan` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `siswa` (
  `nis` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_lengkap` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_kelas` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `foto_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `siswa` (`nis`, `nama_lengkap`, `id_kelas`, `foto_url`, `created_at`) VALUES
('1234567890', 'eko setiawan', 'KLS_1785489957668', NULL, '2026-07-31 03:37:35');

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

--
-- Table structure for table `siswa_data_pribadi`
--

CREATE TABLE `siswa_data_pribadi` (
  `nis` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nisn` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tempat_lahir` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tanggal_lahir` date DEFAULT NULL,
  `jenis_kelamin` enum('Laki-laki','Perempuan') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `agama` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kewarganegaraan` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'Indonesia',
  `alamat` text COLLATE utf8mb4_unicode_ci,
  `rt` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `rw` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kelurahan` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kecamatan` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kota` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `provinsi` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telp` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nama_ayah` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pendidikan_ayah` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pekerjaan_ayah` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `no_hp_ayah` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nama_ibu` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pendidikan_ibu` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pekerjaan_ibu` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `no_hp_ibu` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `siswa_data_pribadi`
--

INSERT INTO `siswa_data_pribadi` (`nis`, `nisn`, `tempat_lahir`, `tanggal_lahir`, `jenis_kelamin`, `agama`, `kewarganegaraan`, `alamat`, `rt`, `rw`, `kelurahan`, `kecamatan`, `kota`, `provinsi`, `telp`, `email`, `nama_ayah`, `pendidikan_ayah`, `pekerjaan_ayah`, `no_hp_ayah`, `nama_ibu`, `pendidikan_ibu`, `pekerjaan_ibu`, `no_hp_ibu`, `updated_at`) VALUES
('1234567890', NULL, NULL, NULL, NULL, NULL, 'Indonesia', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'eko@gmail.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-07-31 03:37:35');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `anecdote`
--
ALTER TABLE `anecdote`
  ADD PRIMARY KEY (`id`),
  ADD KEY `target_id` (`target_id`);

--
-- Indexes for table `elearning_aktivitas`
--
ALTER TABLE `elearning_aktivitas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `nuptk_guru` (`nuptk_guru`);

--
-- Indexes for table `elearning_balasan_diskusi`
--
ALTER TABLE `elearning_balasan_diskusi`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_diskusi` (`id_diskusi`);

--
-- Indexes for table `elearning_diskusi`
--
ALTER TABLE `elearning_diskusi`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_pertemuan` (`id_pertemuan`);

--
-- Indexes for table `elearning_jawaban_quiz`
--
ALTER TABLE `elearning_jawaban_quiz`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_quiz` (`id_quiz`),
  ADD KEY `nis_siswa` (`nis_siswa`);

--
-- Indexes for table `elearning_modul`
--
ALTER TABLE `elearning_modul`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_pertemuan` (`id_pertemuan`);

--
-- Indexes for table `elearning_pertemuan`
--
ALTER TABLE `elearning_pertemuan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_aktivitas` (`id_aktivitas`);

--
-- Indexes for table `elearning_quiz`
--
ALTER TABLE `elearning_quiz`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_pertemuan` (`id_pertemuan`);

--
-- Indexes for table `elearning_video`
--
ALTER TABLE `elearning_video`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_pertemuan` (`id_pertemuan`);

--
-- Indexes for table `guru`
--
ALTER TABLE `guru`
  ADD PRIMARY KEY (`nuptk`);

--
-- Indexes for table `info_berita`
--
ALTER TABLE `info_berita`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `info_galeri_album`
--
ALTER TABLE `info_galeri_album`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `info_galeri_item`
--
ALTER TABLE `info_galeri_item`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_album` (`id_album`);

--
-- Indexes for table `info_kontak`
--
ALTER TABLE `info_kontak`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `info_pesan`
--
ALTER TABLE `info_pesan`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `info_profil`
--
ALTER TABLE `info_profil`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `info_slider`
--
ALTER TABLE `info_slider`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `info_sosmed`
--
ALTER TABLE `info_sosmed`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `inventaris_barang`
--
ALTER TABLE `inventaris_barang`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `kode_barang` (`kode_barang`),
  ADD KEY `id_ruangan` (`id_ruangan`);

--
-- Indexes for table `jadwal_mengajar`
--
ALTER TABLE `jadwal_mengajar`
  ADD PRIMARY KEY (`id`),
  ADD KEY `nuptk_guru` (`nuptk_guru`),
  ADD KEY `id_kelas` (`id_kelas`);

--
-- Indexes for table `kelas`
--
ALTER TABLE `kelas`
  ADD PRIMARY KEY (`id_kelas`),
  ADD UNIQUE KEY `nama_kelas` (`nama_kelas`),
  ADD KEY `nuptk_wali_kelas` (`nuptk_wali_kelas`);

--
-- Indexes for table `laporan_kerusakan`
--
ALTER TABLE `laporan_kerusakan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_barang` (`id_barang`);

--
-- Indexes for table `perpus_buku`
--
ALTER TABLE `perpus_buku`
  ADD PRIMARY KEY (`kode_buku`);

--
-- Indexes for table `perpus_peminjaman`
--
ALTER TABLE `perpus_peminjaman`
  ADD PRIMARY KEY (`id_transaksi`),
  ADD KEY `nis_siswa` (`nis_siswa`),
  ADD KEY `kode_buku` (`kode_buku`);

--
-- Indexes for table `perpus_pengaturan`
--
ALTER TABLE `perpus_pengaturan`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prestasi`
--
ALTER TABLE `prestasi`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `psb_pendaftar`
--
ALTER TABLE `psb_pendaftar`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `psb_settings`
--
ALTER TABLE `psb_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `psb_wa_log`
--
ALTER TABLE `psb_wa_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_pendaftar` (`id_pendaftar`);

--
-- Indexes for table `raport_isi`
--
ALTER TABLE `raport_isi`
  ADD PRIMARY KEY (`id`),
  ADD KEY `nis_siswa` (`nis_siswa`),
  ADD KEY `nuptk_guru` (`nuptk_guru`),
  ADD KEY `id_template` (`id_template`);

--
-- Indexes for table `raport_kirim`
--
ALTER TABLE `raport_kirim`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id_template` (`id_template`),
  ADD KEY `nuptk_guru_tujuan` (`nuptk_guru_tujuan`),
  ADD KEY `nis_siswa` (`nis_siswa`);

--
-- Indexes for table `raport_template`
--
ALTER TABLE `raport_template`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ruangan`
--
ALTER TABLE `ruangan`
  ADD PRIMARY KEY (`id_ruangan`),
  ADD UNIQUE KEY `nama_ruangan` (`nama_ruangan`);

--
-- Indexes for table `siswa`
--
ALTER TABLE `siswa`
  ADD PRIMARY KEY (`nis`),
  ADD KEY `id_kelas` (`id_kelas`);

--
-- Indexes for table `siswa_data_pribadi`
--
ALTER TABLE `siswa_data_pribadi`
  ADD PRIMARY KEY (`nis`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `anecdote`
--
ALTER TABLE `anecdote`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `elearning_aktivitas`
--
ALTER TABLE `elearning_aktivitas`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_balasan_diskusi`
--
ALTER TABLE `elearning_balasan_diskusi`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_diskusi`
--
ALTER TABLE `elearning_diskusi`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_jawaban_quiz`
--
ALTER TABLE `elearning_jawaban_quiz`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_modul`
--
ALTER TABLE `elearning_modul`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_pertemuan`
--
ALTER TABLE `elearning_pertemuan`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_quiz`
--
ALTER TABLE `elearning_quiz`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `elearning_video`
--
ALTER TABLE `elearning_video`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `info_berita`
--
ALTER TABLE `info_berita`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `info_galeri_album`
--
ALTER TABLE `info_galeri_album`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `info_galeri_item`
--
ALTER TABLE `info_galeri_item`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `info_pesan`
--
ALTER TABLE `info_pesan`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `info_slider`
--
ALTER TABLE `info_slider`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `info_sosmed`
--
ALTER TABLE `info_sosmed`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `inventaris_barang`
--
ALTER TABLE `inventaris_barang`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `jadwal_mengajar`
--
ALTER TABLE `jadwal_mengajar`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `psb_pendaftar`
--
ALTER TABLE `psb_pendaftar`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `psb_wa_log`
--
ALTER TABLE `psb_wa_log`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `raport_isi`
--
ALTER TABLE `raport_isi`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `raport_kirim`
--
ALTER TABLE `raport_kirim`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `raport_template`
--
ALTER TABLE `raport_template`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ruangan`
--
ALTER TABLE `ruangan`
  MODIFY `id_ruangan` int NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `elearning_aktivitas`
--
ALTER TABLE `elearning_aktivitas`
  ADD CONSTRAINT `elearning_aktivitas_ibfk_1` FOREIGN KEY (`nuptk_guru`) REFERENCES `guru` (`nuptk`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_balasan_diskusi`
--
ALTER TABLE `elearning_balasan_diskusi`
  ADD CONSTRAINT `elearning_balasan_diskusi_ibfk_1` FOREIGN KEY (`id_diskusi`) REFERENCES `elearning_diskusi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_diskusi`
--
ALTER TABLE `elearning_diskusi`
  ADD CONSTRAINT `elearning_diskusi_ibfk_1` FOREIGN KEY (`id_pertemuan`) REFERENCES `elearning_pertemuan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_jawaban_quiz`
--
ALTER TABLE `elearning_jawaban_quiz`
  ADD CONSTRAINT `elearning_jawaban_quiz_ibfk_1` FOREIGN KEY (`id_quiz`) REFERENCES `elearning_quiz` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `elearning_jawaban_quiz_ibfk_2` FOREIGN KEY (`nis_siswa`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_modul`
--
ALTER TABLE `elearning_modul`
  ADD CONSTRAINT `elearning_modul_ibfk_1` FOREIGN KEY (`id_pertemuan`) REFERENCES `elearning_pertemuan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_pertemuan`
--
ALTER TABLE `elearning_pertemuan`
  ADD CONSTRAINT `elearning_pertemuan_ibfk_1` FOREIGN KEY (`id_aktivitas`) REFERENCES `elearning_aktivitas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_quiz`
--
ALTER TABLE `elearning_quiz`
  ADD CONSTRAINT `elearning_quiz_ibfk_1` FOREIGN KEY (`id_pertemuan`) REFERENCES `elearning_pertemuan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `elearning_video`
--
ALTER TABLE `elearning_video`
  ADD CONSTRAINT `elearning_video_ibfk_1` FOREIGN KEY (`id_pertemuan`) REFERENCES `elearning_pertemuan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `guru`
--
ALTER TABLE `guru`
  ADD CONSTRAINT `guru_ibfk_1` FOREIGN KEY (`nuptk`) REFERENCES `users` (`nuptk`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `info_galeri_item`
--
ALTER TABLE `info_galeri_item`
  ADD CONSTRAINT `info_galeri_item_ibfk_1` FOREIGN KEY (`id_album`) REFERENCES `info_galeri_album` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `inventaris_barang`
--
ALTER TABLE `inventaris_barang`
  ADD CONSTRAINT `inventaris_barang_ibfk_1` FOREIGN KEY (`id_ruangan`) REFERENCES `ruangan` (`id_ruangan`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `jadwal_mengajar`
--
ALTER TABLE `jadwal_mengajar`
  ADD CONSTRAINT `jadwal_mengajar_ibfk_1` FOREIGN KEY (`nuptk_guru`) REFERENCES `guru` (`nuptk`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `jadwal_mengajar_ibfk_2` FOREIGN KEY (`id_kelas`) REFERENCES `kelas` (`id_kelas`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `kelas`
--
ALTER TABLE `kelas`
  ADD CONSTRAINT `kelas_ibfk_1` FOREIGN KEY (`nuptk_wali_kelas`) REFERENCES `guru` (`nuptk`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `laporan_kerusakan`
--
ALTER TABLE `laporan_kerusakan`
  ADD CONSTRAINT `laporan_kerusakan_ibfk_1` FOREIGN KEY (`id_barang`) REFERENCES `inventaris_barang` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `perpus_peminjaman`
--
ALTER TABLE `perpus_peminjaman`
  ADD CONSTRAINT `perpus_peminjaman_ibfk_1` FOREIGN KEY (`nis_siswa`) REFERENCES `siswa` (`nis`) ON DELETE SET NULL,
  ADD CONSTRAINT `perpus_peminjaman_ibfk_2` FOREIGN KEY (`kode_buku`) REFERENCES `perpus_buku` (`kode_buku`) ON DELETE SET NULL;

--
-- Constraints for table `psb_wa_log`
--
ALTER TABLE `psb_wa_log`
  ADD CONSTRAINT `psb_wa_log_ibfk_1` FOREIGN KEY (`id_pendaftar`) REFERENCES `psb_pendaftar` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `raport_isi`
--
ALTER TABLE `raport_isi`
  ADD CONSTRAINT `raport_isi_ibfk_1` FOREIGN KEY (`nis_siswa`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE,
  ADD CONSTRAINT `raport_isi_ibfk_2` FOREIGN KEY (`nuptk_guru`) REFERENCES `guru` (`nuptk`) ON DELETE CASCADE,
  ADD CONSTRAINT `raport_isi_ibfk_3` FOREIGN KEY (`id_template`) REFERENCES `raport_template` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `raport_kirim`
--
ALTER TABLE `raport_kirim`
  ADD CONSTRAINT `raport_kirim_ibfk_1` FOREIGN KEY (`id_template`) REFERENCES `raport_template` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `raport_kirim_ibfk_2` FOREIGN KEY (`nuptk_guru_tujuan`) REFERENCES `guru` (`nuptk`) ON DELETE SET NULL,
  ADD CONSTRAINT `raport_kirim_ibfk_3` FOREIGN KEY (`nis_siswa`) REFERENCES `siswa` (`nis`) ON DELETE SET NULL;

--
-- Constraints for table `siswa`
--
ALTER TABLE `siswa`
  ADD CONSTRAINT `siswa_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `users` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `siswa_ibfk_2` FOREIGN KEY (`id_kelas`) REFERENCES `kelas` (`id_kelas`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `siswa_data_pribadi`
--
ALTER TABLE `siswa_data_pribadi`
  ADD CONSTRAINT `siswa_data_pribadi_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

