Add mailer system

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-12 09:04:51 +01:00
parent 9688f51bc5
commit 9edb5f31d0
10 changed files with 364 additions and 6 deletions

View File

@@ -0,0 +1,11 @@
CREATE TABLE emails (
id TEXT PRIMARY KEY,
email_address_to TEXT NOT NULL,
subject TEXT NOT NULL,
text_body TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
sent_at TIMESTAMP WITH TIME ZONE
);
CREATE INDEX ON emails (sent_at) WHERE sent_at IS NULL;

View File

@@ -0,0 +1,8 @@
ALTER TABLE emails ADD COLUMN recipient_name TEXT NOT NULL;
ALTER TABLE emails RENAME COLUMN email_address_to TO recipient_email;
ALTER TABLE emails ALTER COLUMN created_at DROP DEFAULT;
ALTER TABLE emails ALTER COLUMN updated_at DROP DEFAULT;
ALTER TABLE emails ALTER COLUMN created_at SET NOT NULL;
ALTER TABLE emails ALTER COLUMN updated_at SET NOT NULL;