nidus-sync/db/migrations/00077_mailer_rework.sql
Eli Ribble a0eee3a95f
Rework mailer database schema, add UUID to mailers
At this point, I sent out our first test mailers for Delta.
2026-03-02 23:27:55 +00:00

29 lines
820 B
SQL

-- +goose Up
DROP TABLE comms.mailer;
DROP TYPE comms.MailerType;
CREATE TABLE comms.mailer (
address_id INTEGER NOT NULL REFERENCES address(id),
created TIMESTAMP WITHOUT TIME ZONE NOT NULL,
id SERIAL NOT NULL,
recipient TEXT NOT NULL,
uuid UUID NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE compliance_report_request_mailer (
compliance_report_request_id INTEGER NOT NULL REFERENCES compliance_report_request(id),
mailer_id INTEGER NOT NULL REFERENCES comms.mailer(id),
UNIQUE(compliance_report_request_id, mailer_id)
);
-- +goose Down
DROP TABLE compliance_report_request_mailer;
DROP TABLE comms.mailer;
CREATE TYPE comms.MailerType AS ENUM (
'green-pool'
);
CREATE TABLE comms.mailer (
created TIMESTAMP WITHOUT TIME ZONE NOT NULL,
id SERIAL NOT NULL,
type_ comms.MailerType NOT NULL,
PRIMARY KEY(id)
);