-- Active: 1739365328253@@127.0.0.1@3306@madrasha





-- MySQL ডাটাবেজ টেবিল তৈরি করার কোড (users টেবিল ছাড়া)
CREATE TABLE IF NOT EXISTS time_slots (
    id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) NOT NULL,
    time_slot VARCHAR(100) NOT NULL,

    FOREIGN KEY (email) REFERENCES madrashas(email) ON DELETE CASCADE ON UPDATE CASCADE,

    INDEX (email)


) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS class_time (
    id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) NOT NULL,
    class_name VARCHAR(100) NOT NULL,

    FOREIGN KEY (email) REFERENCES madrashas(email) ON DELETE CASCADE ON UPDATE CASCADE,

    INDEX (email)



) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS schedule_data (
    id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) NOT NULL,
    class_name VARCHAR(100) NOT NULL,
    time_slot VARCHAR(100) NOT NULL,
    teacher VARCHAR(255),
    quantity VARCHAR(255),

    FOREIGN KEY (email) REFERENCES madrashas(email) ON DELETE CASCADE ON UPDATE CASCADE,

    INDEX (email),
    INDEX (class_name),
    INDEX (time_slot)

    
) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;





CREATE TABLE class_schedules (
    id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) NOT NULL,
    time_slots TEXT NOT NULL,
    classes TEXT NOT NULL,
    schedule_data TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;



DROP TABLE class_schedules;