-- Committee chair mapping table used to control chair-only assignment options.

CREATE TABLE IF NOT EXISTS committee_chairs (
    id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    committee_name VARCHAR(100) NOT NULL,
    username VARCHAR(100) NOT NULL,
    is_active TINYINT(1) NOT NULL DEFAULT 1,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    UNIQUE KEY uniq_committee_username (committee_name, username),
    INDEX idx_committee_name (committee_name),
    INDEX idx_username (username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Example rows:
-- INSERT INTO committee_chairs (committee_name, username, is_active)
-- VALUES ('Website', 'janedoe', 1), ('Finance', 'bobsmith', 1);
