Implemented audit log system
This commit is contained in:
1
api/migrations/sqls/20260212165353-audit-log-down.sql
Normal file
1
api/migrations/sqls/20260212165353-audit-log-down.sql
Normal file
@@ -0,0 +1 @@
|
||||
/* Replace with your SQL commands */
|
||||
17
api/migrations/sqls/20260212165353-audit-log-up.sql
Normal file
17
api/migrations/sqls/20260212165353-audit-log-up.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE audit_log (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
-- "area.action" (e.g., 'calendarEvent.create', 'member.update_rank')
|
||||
action_type VARCHAR(100) NOT NULL,
|
||||
-- The JSON blob containing detailed information
|
||||
payload JSON DEFAULT NULL,
|
||||
-- Identifying the actor
|
||||
created_by INT,
|
||||
-- The ID of the resource being acted upon
|
||||
target_id INT DEFAULT NULL,
|
||||
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_created_by FOREIGN KEY (created_by) REFERENCES members(id) ON DELETE
|
||||
SET NULL,
|
||||
INDEX idx_action (action_type),
|
||||
INDEX idx_target (target_id)
|
||||
);
|
||||
Reference in New Issue
Block a user