CREATE TABLE class_routine (
     id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) NOT NULL,
    name VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

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


    INDEX (email)  -- Add index for better performance when querying by email

) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;


DROP TABLE class_routine;


-- Create class_time_slots table
CREATE TABLE class_routine_time_slots (
      id INT AUTO_INCREMENT PRIMARY KEY,
    class_id INT NOT NULL,
    start_time TIME NOT NULL,
    end_time TIME NOT NULL,

    FOREIGN KEY (class_id) REFERENCES class_routine(id) ON DELETE CASCADE
    
) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;