USE iimplin_ogpanel;

-- ==========================
-- Admin Users
-- ==========================

CREATE TABLE admin_users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(100) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- ==========================
-- Universities
-- ==========================

CREATE TABLE universities (
    id INT AUTO_INCREMENT PRIMARY KEY,
    university_name VARCHAR(255) NOT NULL UNIQUE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- ==========================
-- Entries
-- ==========================

CREATE TABLE entries (
    id INT AUTO_INCREMENT PRIMARY KEY,
    university_id INT NOT NULL,
    pdf_name VARCHAR(255) NOT NULL UNIQUE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT fk_university
    FOREIGN KEY (university_id)
    REFERENCES universities(id)
    ON DELETE CASCADE
);