feat(dm): migrated all the dm topics
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 4m26s

This commit is contained in:
2026-06-26 11:05:17 -05:00
parent 012a7e83b2
commit 47b149d1ea
48 changed files with 14156 additions and 44 deletions

View File

@@ -19,6 +19,7 @@ export async function setupDbNotifications() {
await setupLogsNotifications();
await setupDockScansNotifications();
await setupProdAuditNotifications();
log.info({}, "DB notifications setup complete");
}
@@ -97,3 +98,36 @@ async function setupDockScansNotifications() {
log.info({}, "Dock scan DB notification trigger ready");
}
async function setupProdAuditNotifications() {
await db.execute(sql`
CREATE OR REPLACE FUNCTION notify_auditLog_inserted()
RETURNS trigger AS $$
BEGIN
PERFORM pg_notify(
'auditLog_inserted',
json_build_object(
'table', TG_TABLE_NAME,
'action', TG_OP,
'id', NEW.id
)::text
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
`);
await db.execute(sql`
DROP TRIGGER IF EXISTS auditLog_inserted_notify_trigger ON prod_audit_log;
`);
await db.execute(sql`
CREATE TRIGGER auditLog_inserted_notify_trigger
AFTER INSERT ON prod_audit_log
FOR EACH ROW
EXECUTE FUNCTION notify_auditLog_inserted();
`);
log.info({}, "Audit Log DB notification trigger ready");
}