39024-vm/db/migrations/20260306_002_surat_keluar_log.sql
Flatlogic Bot fd86c37615 002
2026-03-06 13:38:01 +00:00

15 lines
555 B
SQL

-- Add status transition audit trail
CREATE TABLE IF NOT EXISTS surat_keluar_log (
id INT AUTO_INCREMENT PRIMARY KEY,
surat_keluar_id INT NOT NULL,
old_status VARCHAR(20),
new_status VARCHAR(20),
user_id INT,
note TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (surat_keluar_id) REFERENCES surat_keluar(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Ensure enum has proper values if we needed to update (already has draft, review, approved, kirim)
-- Since they exist, we just add the logging table.