budgit/internal/db/migrations/00010_create_transaction_audit_logs_table.sql
juancwu da718427bd
All checks were successful
Deploy / build-and-deploy (push) Successful in 1m27s
feat: drop sqlite support
2026-05-04 00:29:45 +00:00

19 lines
595 B
SQL

-- +goose Up
-- +goose StatementBegin
CREATE TABLE transaction_audit_logs (
id TEXT PRIMARY KEY NOT NULL,
transaction_id TEXT NOT NULL,
actor_id TEXT REFERENCES users(id) ON DELETE SET NULL,
action TEXT NOT NULL,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_transaction_audit_logs_transaction_id_created_at
ON transaction_audit_logs (transaction_id, created_at DESC);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE transaction_audit_logs;
-- +goose StatementEnd