15 lines
555 B
SQL
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.
|