23 lines
871 B
SQL
23 lines
871 B
SQL
-- Core schema for School Management MVP slice (idempotent)
|
|
CREATE TABLE IF NOT EXISTS classes (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
name VARCHAR(120) NOT NULL,
|
|
grade_level VARCHAR(20) NOT NULL,
|
|
homeroom_teacher VARCHAR(120) DEFAULT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
CREATE TABLE IF NOT EXISTS students (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
student_code VARCHAR(30) NOT NULL UNIQUE,
|
|
full_name VARCHAR(160) NOT NULL,
|
|
gender VARCHAR(12) DEFAULT NULL,
|
|
class_id INT DEFAULT NULL,
|
|
guardian_name VARCHAR(160) DEFAULT NULL,
|
|
status VARCHAR(20) NOT NULL DEFAULT 'aktif',
|
|
notes TEXT DEFAULT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
INDEX idx_students_class (class_id),
|
|
INDEX idx_students_status (status)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|