-- =========================================================================
-- MIGRATION: Senarai Semak Permulaan Tahun & Log Sandaran (Fasa 4)
-- Jalankan di phpMyAdmin > tab SQL, pada database SPMS sedia ada anda.
-- =========================================================================

CREATE TABLE IF NOT EXISTS year_checklist_items (
    item_id         CHAR(36) PRIMARY KEY,
    fiscal_year     SMALLINT NOT NULL,
    task_key        VARCHAR(100) NOT NULL,
    completed       TINYINT(1) NOT NULL DEFAULT 0,
    completed_by    CHAR(36) NULL,
    completed_at    DATETIME NULL,
    UNIQUE KEY uniq_year_task (fiscal_year, task_key)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS backup_log (
    backup_id       CHAR(36) PRIMARY KEY,
    created_by      CHAR(36) NULL,
    created_at      DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
