feat(ADM-018): completed feature

This commit is contained in:
chattie
2026-08-17 22:23:10 +02:00
parent cf1c69fc8b
commit d595b4871f
871 changed files with 47411 additions and 281 deletions

View File

@@ -0,0 +1,26 @@
/** Notification messages with idempotent dispatch. */
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
export const up = (pgm) => {
pgm.sql(`
CREATE TABLE notifications_messages (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
event_id text NOT NULL UNIQUE,
channel text NOT NULL DEFAULT 'email',
template text NOT NULL,
recipient text NOT NULL,
subject text NOT NULL,
body text NOT NULL,
status text NOT NULL DEFAULT 'sent',
created_at timestamptz NOT NULL DEFAULT now(),
CONSTRAINT notifications_messages_channel_check CHECK (channel = 'email'),
CONSTRAINT notifications_messages_status_check CHECK (status IN ('sent', 'failed', 'queued'))
)
`);
pgm.sql('CREATE INDEX notifications_messages_template_idx ON notifications_messages (template)');
};
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
export const down = (pgm) => {
pgm.sql('DROP TABLE IF EXISTS notifications_messages');
};