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

START TRANSACTION;



--
-- Database: `db_raport`
--

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

--
-- Table structure for table `absensi_siswa`
--

CREATE TABLE `absensi_siswa` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `sakit` int(11) DEFAULT 0,
  `izin` int(11) DEFAULT 0,
  `alpa` int(11) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `absensi_siswa`
--

INSERT INTO `absensi_siswa` (`id`, `siswa_id`, `tahun_ajaran_id`, `sakit`, `izin`, `alpa`, `created_at`) VALUES
(1, 2, 2, 1, 2, 3, '2026-06-05 00:05:58'),
(2, 1, 2, 4, 5, 6, '2026-06-05 00:05:58');

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

--
-- Table structure for table `catatan_wali`
--

CREATE TABLE `catatan_wali` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `catatan` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `catatan_wali`
--

INSERT INTO `catatan_wali` (`id`, `siswa_id`, `tahun_ajaran_id`, `catatan`, `created_at`) VALUES
(1, 2, 2, 'pertshnkan prestasimu', '2026-06-05 00:04:07'),
(2, 1, 2, 'lanjutkan', '2026-06-05 00:04:07');

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

--
-- Table structure for table `cp`
--

CREATE TABLE `cp` (
  `id` int(11) NOT NULL,
  `mapel_id` int(11) NOT NULL,
  `tingkat` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `nomor_cp` int(11) NOT NULL,
  `deskripsi` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `cp`
--

INSERT INTO `cp` (`id`, `mapel_id`, `tingkat`, `tahun_ajaran_id`, `nomor_cp`, `deskripsi`, `created_at`) VALUES
(6, 13, 1, 2, 1, 'Mengenal huruf hijaiyah', '2026-06-02 00:20:02'),
(7, 13, 1, 2, 2, 'Membaca kosakata sederhana', '2026-06-02 00:20:02'),
(8, 13, 1, 2, 3, 'Menulis kosakata sederhana', '2026-06-02 00:20:02'),
(9, 3, 1, 2, 1, 'bisa berbahasa', '2026-06-02 02:04:14'),
(10, 3, 1, 2, 2, 'bisa menulis', '2026-06-02 02:04:34');

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

--
-- Table structure for table `ekstrakurikuler`
--

CREATE TABLE `ekstrakurikuler` (
  `id` int(11) NOT NULL,
  `nama_ekskul` varchar(100) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `kategori` enum('WAJIB','LIFESKILL','EKSTRA') NOT NULL DEFAULT 'EKSTRA'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ekstrakurikuler`
--

INSERT INTO `ekstrakurikuler` (`id`, `nama_ekskul`, `created_at`, `kategori`) VALUES
(5, 'BPI', '2026-06-04 06:07:32', 'WAJIB'),
(6, 'Pramuka', '2026-06-04 06:07:47', 'WAJIB'),
(7, 'memasak', '2026-06-04 06:08:01', 'LIFESKILL'),
(8, 'TIK', '2026-06-04 06:08:12', 'EKSTRA');

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

--
-- Table structure for table `ekstrakurikuler_kd`
--

CREATE TABLE `ekstrakurikuler_kd` (
  `id` int(11) NOT NULL,
  `ekstrakurikuler_id` int(11) NOT NULL,
  `tingkat` int(11) NOT NULL DEFAULT 1,
  `nomor_kd` int(11) NOT NULL,
  `deskripsi` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ekstrakurikuler_kd`
--

INSERT INTO `ekstrakurikuler_kd` (`id`, `ekstrakurikuler_id`, `tingkat`, `nomor_kd`, `deskripsi`) VALUES
(5, 5, 1, 1, 'bagus dalam sholat'),
(6, 6, 1, 1, 'bgus dalamtali menali'),
(7, 6, 1, 2, 'bagus dalam lbb');

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

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

CREATE TABLE `guru` (
  `id` int(11) NOT NULL,
  `nip` varchar(50) DEFAULT NULL,
  `nuptk` varchar(50) DEFAULT NULL,
  `nama` varchar(150) NOT NULL,
  `jenis_kelamin` enum('L','P') DEFAULT NULL,
  `tempat_lahir` varchar(100) DEFAULT NULL,
  `tanggal_lahir` date DEFAULT NULL,
  `alamat` text DEFAULT NULL,
  `no_hp` varchar(30) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `status_aktif` enum('Aktif','Nonaktif') DEFAULT 'Aktif',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `guru` (`id`, `nip`, `nuptk`, `nama`, `jenis_kelamin`, `tempat_lahir`, `tanggal_lahir`, `alamat`, `no_hp`, `email`, `status_aktif`, `created_at`) VALUES
(3, '1234', '4440766667120002', 'silmi', 'L', 'ngawi', '2026-05-30', 'ngawi', '', '', 'Aktif', '2026-05-30 05:27:33'),
(4, '-', '-', 'ari dwi s', 'L', '', '2026-06-05', '', '', 'aridwisulissetiawan@gmail.com', 'Aktif', '2026-06-05 05:31:58');

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

--
-- Table structure for table `identitas_sekolah`
--

CREATE TABLE `identitas_sekolah` (
  `id` int(11) NOT NULL,
  `nama_sekolah` varchar(200) DEFAULT NULL,
  `npsn` varchar(50) DEFAULT NULL,
  `alamat` text DEFAULT NULL,
  `kelurahan` varchar(100) DEFAULT NULL,
  `kecamatan` varchar(100) DEFAULT NULL,
  `kabupaten` varchar(100) DEFAULT NULL,
  `provinsi` varchar(100) DEFAULT NULL,
  `kode_pos` varchar(10) DEFAULT NULL,
  `telepon` varchar(50) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `identitas_sekolah`
--

INSERT INTO `identitas_sekolah` (`id`, `nama_sekolah`, `npsn`, `alamat`, `kelurahan`, `kecamatan`, `kabupaten`, `provinsi`, `kode_pos`, `telepon`, `email`, `website`, `logo`, `created_at`) VALUES
(1, 'sdit harum', '12345', 'ngawi', 'beran', 'widodaren', 'madiun', 'jatim', '321', '12345671', 'ww@gmail', 'kkll.', NULL, '2026-05-29 01:30:25');

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

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

CREATE TABLE `kelas` (
  `id` int(11) NOT NULL,
  `nama_kelas` varchar(20) NOT NULL,
  `tingkat` int(11) NOT NULL,
  `keterangan` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `kelas` (`id`, `nama_kelas`, `tingkat`, `keterangan`, `created_at`) VALUES
(1, '1A', 1, NULL, '2026-06-02 00:28:06'),
(2, '1B', 1, NULL, '2026-06-02 00:28:06'),
(3, '1C', 1, NULL, '2026-06-02 00:28:06'),
(4, '2A', 2, NULL, '2026-06-02 00:28:06'),
(5, '2B', 2, NULL, '2026-06-02 00:28:06'),
(6, '2C', 2, NULL, '2026-06-02 00:28:06'),
(7, '2D', 2, NULL, '2026-06-02 00:28:06'),
(8, '3A', 3, NULL, '2026-06-02 00:28:06'),
(9, '3B', 3, NULL, '2026-06-02 00:28:06'),
(10, '3C', 3, NULL, '2026-06-02 00:28:06'),
(11, '3D', 3, NULL, '2026-06-02 00:28:06'),
(12, '4A', 4, NULL, '2026-06-02 00:28:06'),
(13, '4B', 4, NULL, '2026-06-02 00:28:06'),
(14, '4C', 4, NULL, '2026-06-02 00:28:06'),
(15, '5A', 5, NULL, '2026-06-02 00:28:06'),
(16, '5B', 5, NULL, '2026-06-02 00:28:06'),
(17, '5C', 5, NULL, '2026-06-02 00:28:06'),
(18, '6A', 6, NULL, '2026-06-02 00:28:06'),
(19, '6B', 6, NULL, '2026-06-02 00:28:06'),
(20, '6c', 6, NULL, '2026-06-02 00:28:06');

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

--
-- Table structure for table `kepala_sekolah`
--

CREATE TABLE `kepala_sekolah` (
  `id` int(11) NOT NULL,
  `nama` varchar(150) NOT NULL,
  `nip` varchar(50) DEFAULT NULL,
  `nuptk` varchar(50) DEFAULT NULL,
  `jabatan` varchar(100) DEFAULT 'Kepala Sekolah',
  `tahun_ajaran_id` int(11) NOT NULL,
  `aktif` enum('Ya','Tidak') DEFAULT 'Ya',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `kepala_sekolah`
--

INSERT INTO `kepala_sekolah` (`id`, `nama`, `nip`, `nuptk`, `jabatan`, `tahun_ajaran_id`, `aktif`, `created_at`) VALUES
(2, 'epi', '-', '-', 'Kepala Sekolah', 2, 'Ya', '2026-05-29 01:43:53');

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

--
-- Table structure for table `kokurikuler_dimensi`
--

CREATE TABLE `kokurikuler_dimensi` (
  `id` int(11) NOT NULL,
  `nama_dimensi` varchar(100) NOT NULL,
  `deskripsi` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `kokurikuler_dimensi`
--

INSERT INTO `kokurikuler_dimensi` (`id`, `nama_dimensi`, `deskripsi`, `created_at`) VALUES
(1, 'Dimensi Keimanan', 'melaksanakan sholat tepat waktu', '2026-06-03 00:30:09'),
(2, 'Dimensi Kewargaan', 'menyanyikan lagu nasional', '2026-06-03 00:30:09'),
(3, 'Dimensi Kreativitas', 'menghasilkan karya', '2026-06-03 00:30:09'),
(4, 'Dimensi Kesehatan', 'mengikuti senam setiap hari Jumat di sekolah', '2026-06-03 00:30:09');

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

--
-- Table structure for table `mapel`
--

CREATE TABLE `mapel` (
  `id` int(11) NOT NULL,
  `kode_mapel` varchar(20) DEFAULT NULL,
  `nama_mapel` varchar(100) NOT NULL,
  `kelompok` varchar(50) DEFAULT NULL,
  `kkm` int(11) DEFAULT 75,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `jenis_mapel` enum('WALIKELAS','GURU_KHUSUS','KEDUANYA') DEFAULT 'WALIKELAS'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `mapel`
--

INSERT INTO `mapel` (`id`, `kode_mapel`, `nama_mapel`, `kelompok`, `kkm`, `created_at`, `jenis_mapel`) VALUES
(1, 'PAI', 'Pendidikan Agama Islam dan Budi Pekerti', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(2, 'PANC', 'Pendidikan Pancasila', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(3, 'BIND', 'Bahasa Indonesia', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(4, 'MTK', 'Matematika', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(5, 'IPAS', 'IPAS', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(6, 'SMUS', 'Seni Musik', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(7, 'STAR', 'Seni Tari', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(8, 'SRUP', 'Seni Rupa', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(9, 'STEA', 'Seni Teater', NULL, 75, '2026-06-02 00:17:41', 'WALIKELAS'),
(10, 'PJOK', 'Pendidikan Jasmani dan Olahraga', NULL, 75, '2026-06-02 00:17:41', 'KEDUANYA'),
(11, 'BIG', 'Bahasa Inggris', NULL, 75, '2026-06-02 00:17:41', 'GURU_KHUSUS'),
(12, 'BJW', 'Bahasa Jawa', NULL, 75, '2026-06-02 00:17:41', 'GURU_KHUSUS'),
(13, 'BAR', 'Bahasa Arab', NULL, 75, '2026-06-02 00:17:41', 'GURU_KHUSUS');

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

--
-- Table structure for table `mengajar`
--

CREATE TABLE `mengajar` (
  `id` int(11) NOT NULL,
  `guru_id` int(11) NOT NULL,
  `mapel_id` int(11) NOT NULL,
  `kelas_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `mengajar`
--

INSERT INTO `mengajar` (`id`, `guru_id`, `mapel_id`, `kelas_id`, `tahun_ajaran_id`, `created_at`) VALUES
(4, 3, 13, 1, 2, '2026-06-02 00:32:43');

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

--
-- Table structure for table `nilai_cp`
--

CREATE TABLE `nilai_cp` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `cp_id` int(11) NOT NULL,
  `guru_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `kelas_id` int(11) DEFAULT NULL,
  `tugas` decimal(5,2) DEFAULT 0.00,
  `ph` decimal(5,2) DEFAULT 0.00,
  `pts` decimal(5,2) DEFAULT 0.00,
  `pas` decimal(5,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `nilai_cp`
--

INSERT INTO `nilai_cp` (`id`, `siswa_id`, `cp_id`, `guru_id`, `tahun_ajaran_id`, `kelas_id`, `tugas`, `ph`, `pts`, `pas`, `created_at`) VALUES
(1, 1, 6, 3, 2, 1, 90.00, 90.00, 80.00, 70.00, '2026-06-02 01:00:07'),
(2, 1, 7, 3, 2, 1, 90.00, 100.00, 80.00, 80.00, '2026-06-02 01:00:07'),
(3, 1, 8, 3, 2, 1, 80.00, 90.00, NULL, NULL, '2026-06-02 01:00:07'),
(4, 2, 9, 3, 2, 2, 80.00, 90.00, 100.00, 100.00, '2026-06-04 00:24:07'),
(5, 2, 10, 3, 2, 2, 90.00, NULL, NULL, NULL, '2026-06-04 00:24:07'),
(6, 1, 9, 3, 2, 2, 90.00, NULL, NULL, NULL, '2026-06-04 23:44:12'),
(7, 1, 10, 3, 2, 2, NULL, NULL, NULL, NULL, '2026-06-04 23:44:12');

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

--
-- Table structure for table `nilai_ekstrakurikuler`
--

CREATE TABLE `nilai_ekstrakurikuler` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `ekstrakurikuler_id` int(11) NOT NULL,
  `kd_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `nilai` enum('BB','MB','BSH','SB') NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `nilai_ekstrakurikuler`
--

INSERT INTO `nilai_ekstrakurikuler` (`id`, `siswa_id`, `ekstrakurikuler_id`, `kd_id`, `tahun_ajaran_id`, `nilai`, `created_at`) VALUES
(1, 2, 1, 1, 2, 'MB', '2026-06-03 00:10:54'),
(2, 2, 1, 2, 2, 'BSH', '2026-06-03 00:10:54'),
(3, 1, 1, 1, 2, 'SB', '2026-06-03 00:16:46'),
(4, 1, 1, 2, 2, 'SB', '2026-06-03 00:16:46'),
(5, 2, 5, 5, 2, 'BSH', '2026-06-04 06:18:05'),
(6, 2, 6, 6, 2, 'BSH', '2026-06-04 06:18:28'),
(7, 2, 6, 7, 2, 'SB', '2026-06-04 06:18:28'),
(8, 1, 6, 6, 2, 'SB', '2026-06-04 06:18:28'),
(9, 1, 6, 7, 2, 'MB', '2026-06-04 06:18:28');

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

--
-- Table structure for table `nilai_kokurikuler`
--

CREATE TABLE `nilai_kokurikuler` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `dimensi_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `nilai` tinyint(4) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `nilai_kokurikuler`
--

INSERT INTO `nilai_kokurikuler` (`id`, `siswa_id`, `dimensi_id`, `tahun_ajaran_id`, `nilai`, `created_at`) VALUES
(1, 2, 1, 2, 4, '2026-06-04 23:43:45'),
(2, 2, 2, 2, 3, '2026-06-04 23:43:45'),
(3, 2, 3, 2, 3, '2026-06-04 23:43:45'),
(4, 2, 4, 2, 3, '2026-06-04 23:43:45'),
(5, 1, 1, 2, 3, '2026-06-04 23:43:45'),
(6, 1, 2, 2, 2, '2026-06-04 23:43:45'),
(7, 1, 3, 2, 2, '2026-06-04 23:43:45'),
(8, 1, 4, 2, 4, '2026-06-04 23:43:45');

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

--
-- Table structure for table `nilai_raport`
--

CREATE TABLE `nilai_raport` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `mapel_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `kkm` int(11) DEFAULT 75,
  `nilai_akhir` decimal(5,2) DEFAULT NULL,
  `cp_tertinggi` text DEFAULT NULL,
  `cp_terendah` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deskripsi_kokurikuler` text DEFAULT NULL,
  `deskripsi_ekskul` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `nilai_raport`
--

INSERT INTO `nilai_raport` (`id`, `siswa_id`, `mapel_id`, `tahun_ajaran_id`, `kkm`, `nilai_akhir`, `cp_tertinggi`, `cp_terendah`, `created_at`, `deskripsi_kokurikuler`, `deskripsi_ekskul`) VALUES
(1, 2, 3, 2, 75, 91.25, 'bisa berbahasa', 'bisa menulis', '2026-06-04 00:24:29', NULL, NULL);

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

--
-- Table structure for table `raport`
--

CREATE TABLE `raport` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `kelas_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `mapel_id` int(11) NOT NULL,
  `nilai_akhir` decimal(5,2) DEFAULT NULL,
  `predikat` char(1) DEFAULT NULL,
  `deskripsi` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `raport_detail`
--

CREATE TABLE `raport_detail` (
  `id` int(11) NOT NULL,
  `raport_id` int(11) NOT NULL,
  `cp_id` int(11) NOT NULL,
  `nilai_cp` decimal(5,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `riwayat_kelas`
--

CREATE TABLE `riwayat_kelas` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `kelas_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `siswa` (
  `id` int(11) NOT NULL,
  `nis` varchar(30) NOT NULL,
  `nisn` varchar(30) NOT NULL,
  `nama` varchar(100) NOT NULL,
  `jk` enum('L','P') NOT NULL,
  `tempat_lahir` varchar(100) DEFAULT NULL,
  `tanggal_lahir` date DEFAULT NULL,
  `alamat` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `kelas_id` int(11) DEFAULT NULL,
  `agama` varchar(50) DEFAULT NULL,
  `nama_ayah` varchar(100) DEFAULT NULL,
  `nama_ibu` varchar(100) DEFAULT NULL,
  `pekerjaan_ayah` varchar(100) DEFAULT NULL,
  `pekerjaan_ibu` varchar(100) DEFAULT NULL,
  `alamat_ortu` text DEFAULT NULL,
  `kelurahan` varchar(100) DEFAULT NULL,
  `kecamatan` varchar(100) DEFAULT NULL,
  `kabupaten` varchar(100) DEFAULT NULL,
  `provinsi` varchar(100) DEFAULT NULL,
  `nama_wali` varchar(100) DEFAULT NULL,
  `pekerjaan_wali` varchar(100) DEFAULT NULL,
  `alamat_wali` text DEFAULT NULL,
  `telp_wali` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `siswa` (`id`, `nis`, `nisn`, `nama`, `jk`, `tempat_lahir`, `tanggal_lahir`, `alamat`, `created_at`, `kelas_id`, `agama`, `nama_ayah`, `nama_ibu`, `pekerjaan_ayah`, `pekerjaan_ibu`, `alamat_ortu`, `kelurahan`, `kecamatan`, `kabupaten`, `provinsi`, `nama_wali`, `pekerjaan_wali`, `alamat_wali`, `telp_wali`) VALUES
(1, '1', '12', 'Wawan', 'L', 'ngawi', '2026-05-29', 'prndon', '2026-05-29 00:20:56', 2, '', 'mulyatin', 'wiwiwk nurhayati', 'pns', 'pns', 'Perumnas prandon Blok P/12', 'beran', 'widodaren', 'Ngawi', 'Jawa Timur', '', '', '', ''),
(2, '2', '2', 'silmi h', 'P', 'ngawi', '2026-06-02', 'ngawi', '2026-06-02 00:40:11', 2, 'i', 'WAWAN', 'ANGGALIA', 'wawan', 'wawan', 'ngawi', '', '', '-', '-', '', '', '', '');

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

--
-- Table structure for table `siswa_ekstrakurikuler`
--

CREATE TABLE `siswa_ekstrakurikuler` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `ekstrakurikuler_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `siswa_kelas`
--

CREATE TABLE `siswa_kelas` (
  `id` int(11) NOT NULL,
  `siswa_id` int(11) NOT NULL,
  `kelas_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `tahun_ajaran` (
  `id` int(11) NOT NULL,
  `tahun_ajaran` varchar(20) NOT NULL,
  `semester` enum('Ganjil','Genap') NOT NULL,
  `status` enum('Aktif','Nonaktif') DEFAULT 'Nonaktif',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `tahun_ajaran` (`id`, `tahun_ajaran`, `semester`, `status`, `created_at`) VALUES
(2, '2025/2026', 'Genap', 'Aktif', '2026-05-29 01:29:19');

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

--
-- Table structure for table `tanggal_raport`
--

CREATE TABLE `tanggal_raport` (
  `id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `tanggal` date NOT NULL,
  `aktif` enum('Ya','Tidak') DEFAULT 'Ya',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tanggal_raport`
--

INSERT INTO `tanggal_raport` (`id`, `tahun_ajaran_id`, `tanggal`, `aktif`, `created_at`) VALUES
(1, 2, '2026-06-19', 'Ya', '2026-06-05 00:52:07');

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

--
-- Table structure for table `wali_kelas`
--

CREATE TABLE `wali_kelas` (
  `id` int(11) NOT NULL,
  `guru_id` int(11) NOT NULL,
  `kelas_id` int(11) NOT NULL,
  `tahun_ajaran_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `wali_kelas`
--

INSERT INTO `wali_kelas` (`id`, `guru_id`, `kelas_id`, `tahun_ajaran_id`, `created_at`) VALUES
(4, 3, 2, 2, '2026-06-02 00:33:01');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `absensi_siswa`
--
ALTER TABLE `absensi_siswa`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unik_absensi` (`siswa_id`,`tahun_ajaran_id`);

--
-- Indexes for table `catatan_wali`
--
ALTER TABLE `catatan_wali`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unik_catatan` (`siswa_id`,`tahun_ajaran_id`);

--
-- Indexes for table `cp`
--
ALTER TABLE `cp`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_cp_mapel` (`mapel_id`),
  ADD KEY `fk_cp_tahun` (`tahun_ajaran_id`);

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

--
-- Indexes for table `ekstrakurikuler_kd`
--
ALTER TABLE `ekstrakurikuler_kd`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ekstrakurikuler_id` (`ekstrakurikuler_id`);

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

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

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

--
-- Indexes for table `kepala_sekolah`
--
ALTER TABLE `kepala_sekolah`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_kepsek_tahun` (`tahun_ajaran_id`);

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

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

--
-- Indexes for table `mengajar`
--
ALTER TABLE `mengajar`
  ADD PRIMARY KEY (`id`),
  ADD KEY `guru_id` (`guru_id`),
  ADD KEY `mapel_id` (`mapel_id`),
  ADD KEY `kelas_id` (`kelas_id`),
  ADD KEY `tahun_ajaran_id` (`tahun_ajaran_id`);

--
-- Indexes for table `nilai_cp`
--
ALTER TABLE `nilai_cp`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `siswa_id` (`siswa_id`,`cp_id`,`tahun_ajaran_id`),
  ADD UNIQUE KEY `siswa_id_2` (`siswa_id`,`cp_id`,`tahun_ajaran_id`),
  ADD KEY `cp_id` (`cp_id`),
  ADD KEY `guru_id` (`guru_id`),
  ADD KEY `fk_nilai_kelas` (`kelas_id`),
  ADD KEY `idx_nilai` (`tahun_ajaran_id`,`kelas_id`,`cp_id`);

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

--
-- Indexes for table `nilai_kokurikuler`
--
ALTER TABLE `nilai_kokurikuler`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unik_kokurikuler` (`siswa_id`,`dimensi_id`,`tahun_ajaran_id`);

--
-- Indexes for table `nilai_raport`
--
ALTER TABLE `nilai_raport`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unik_raport` (`siswa_id`,`mapel_id`,`tahun_ajaran_id`);

--
-- Indexes for table `raport`
--
ALTER TABLE `raport`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unik_raport` (`siswa_id`,`kelas_id`,`tahun_ajaran_id`,`mapel_id`);

--
-- Indexes for table `raport_detail`
--
ALTER TABLE `raport_detail`
  ADD PRIMARY KEY (`id`),
  ADD KEY `raport_id` (`raport_id`);

--
-- Indexes for table `riwayat_kelas`
--
ALTER TABLE `riwayat_kelas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `siswa_id` (`siswa_id`),
  ADD KEY `kelas_id` (`kelas_id`),
  ADD KEY `tahun_ajaran_id` (`tahun_ajaran_id`);

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

--
-- Indexes for table `siswa_ekstrakurikuler`
--
ALTER TABLE `siswa_ekstrakurikuler`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unik_peserta` (`siswa_id`,`ekstrakurikuler_id`,`tahun_ajaran_id`);

--
-- Indexes for table `siswa_kelas`
--
ALTER TABLE `siswa_kelas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `siswa_id` (`siswa_id`),
  ADD KEY `kelas_id` (`kelas_id`),
  ADD KEY `tahun_ajaran_id` (`tahun_ajaran_id`);

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

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

--
-- Indexes for table `wali_kelas`
--
ALTER TABLE `wali_kelas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `guru_id` (`guru_id`),
  ADD KEY `kelas_id` (`kelas_id`),
  ADD KEY `tahun_ajaran_id` (`tahun_ajaran_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `absensi_siswa`
--
ALTER TABLE `absensi_siswa`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `catatan_wali`
--
ALTER TABLE `catatan_wali`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `cp`
--
ALTER TABLE `cp`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `ekstrakurikuler`
--
ALTER TABLE `ekstrakurikuler`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `ekstrakurikuler_kd`
--
ALTER TABLE `ekstrakurikuler_kd`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `guru`
--
ALTER TABLE `guru`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `identitas_sekolah`
--
ALTER TABLE `identitas_sekolah`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `kelas`
--
ALTER TABLE `kelas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `kepala_sekolah`
--
ALTER TABLE `kepala_sekolah`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `kokurikuler_dimensi`
--
ALTER TABLE `kokurikuler_dimensi`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `mapel`
--
ALTER TABLE `mapel`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `mengajar`
--
ALTER TABLE `mengajar`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `nilai_cp`
--
ALTER TABLE `nilai_cp`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `nilai_ekstrakurikuler`
--
ALTER TABLE `nilai_ekstrakurikuler`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `nilai_kokurikuler`
--
ALTER TABLE `nilai_kokurikuler`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `nilai_raport`
--
ALTER TABLE `nilai_raport`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `raport`
--
ALTER TABLE `raport`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `raport_detail`
--
ALTER TABLE `raport_detail`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `riwayat_kelas`
--
ALTER TABLE `riwayat_kelas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `siswa`
--
ALTER TABLE `siswa`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `siswa_ekstrakurikuler`
--
ALTER TABLE `siswa_ekstrakurikuler`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `siswa_kelas`
--
ALTER TABLE `siswa_kelas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `tahun_ajaran`
--
ALTER TABLE `tahun_ajaran`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `tanggal_raport`
--
ALTER TABLE `tanggal_raport`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `wali_kelas`
--
ALTER TABLE `wali_kelas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `cp`
--
ALTER TABLE `cp`
  ADD CONSTRAINT `fk_cp_mapel` FOREIGN KEY (`mapel_id`) REFERENCES `mapel` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_cp_tahun` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ekstrakurikuler_kd`
--
ALTER TABLE `ekstrakurikuler_kd`
  ADD CONSTRAINT `ekstrakurikuler_kd_ibfk_1` FOREIGN KEY (`ekstrakurikuler_id`) REFERENCES `ekstrakurikuler` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `kepala_sekolah`
--
ALTER TABLE `kepala_sekolah`
  ADD CONSTRAINT `fk_kepsek_tahun` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `mengajar`
--
ALTER TABLE `mengajar`
  ADD CONSTRAINT `mengajar_ibfk_1` FOREIGN KEY (`guru_id`) REFERENCES `guru` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `mengajar_ibfk_2` FOREIGN KEY (`mapel_id`) REFERENCES `mapel` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `mengajar_ibfk_3` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `mengajar_ibfk_4` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `nilai_cp`
--
ALTER TABLE `nilai_cp`
  ADD CONSTRAINT `fk_nilai_kelas` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `nilai_cp_ibfk_1` FOREIGN KEY (`siswa_id`) REFERENCES `siswa` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `nilai_cp_ibfk_2` FOREIGN KEY (`cp_id`) REFERENCES `cp` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `nilai_cp_ibfk_3` FOREIGN KEY (`guru_id`) REFERENCES `guru` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `nilai_cp_ibfk_4` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `raport_detail`
--
ALTER TABLE `raport_detail`
  ADD CONSTRAINT `raport_detail_ibfk_1` FOREIGN KEY (`raport_id`) REFERENCES `raport` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `riwayat_kelas`
--
ALTER TABLE `riwayat_kelas`
  ADD CONSTRAINT `riwayat_kelas_ibfk_1` FOREIGN KEY (`siswa_id`) REFERENCES `siswa` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `riwayat_kelas_ibfk_2` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `riwayat_kelas_ibfk_3` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `siswa_kelas`
--
ALTER TABLE `siswa_kelas`
  ADD CONSTRAINT `siswa_kelas_ibfk_1` FOREIGN KEY (`siswa_id`) REFERENCES `siswa` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `siswa_kelas_ibfk_2` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `siswa_kelas_ibfk_3` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `wali_kelas`
--
ALTER TABLE `wali_kelas`
  ADD CONSTRAINT `wali_kelas_ibfk_1` FOREIGN KEY (`guru_id`) REFERENCES `guru` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `wali_kelas_ibfk_2` FOREIGN KEY (`kelas_id`) REFERENCES `kelas` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `wali_kelas_ibfk_3` FOREIGN KEY (`tahun_ajaran_id`) REFERENCES `tahun_ajaran` (`id`) ON DELETE CASCADE;
COMMIT;

