-- Ported from backend/src/main/resources/db/migration/V2__audit_log.sql

CREATE TABLE audit_logs (
    id             BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    created_at     TIMESTAMP    NOT NULL,
    updated_at     TIMESTAMP    NOT NULL,
    actor_id       BIGINT,
    actor_username VARCHAR(50),
    action         VARCHAR(30)  NOT NULL,
    target_type    VARCHAR(30),
    target_id      BIGINT,
    detail         VARCHAR(500)
);
CREATE INDEX idx_audit_created_at ON audit_logs (created_at);
CREATE INDEX idx_audit_action ON audit_logs (action);
