ReviewOS

also looking at this

stacks/analyticshq

fix(dashboard): stop remote commands importing an absent config module

#59
Merged glennmichael123 wants to merge fix/analyticshq-remote-and-subscribers into main
5 files +114 -0
database/migrations/0000000053-create-email-subscriber-tables.sqladded+27-0
Changes to database/migrations/0000000053-create-email-subscriber-tables.sql
@@ -0,0 +1,27 @@
1-- AnalyticsHQ enables the framework newsletter routes, but its application
2-- migration corpus predates the framework Subscriber models. Keep the schema
3-- here so a clean PostgreSQL database can serve the public signup action.
4CREATE TABLE IF NOT EXISTS "subscribers" (
5 "id" BIGSERIAL PRIMARY KEY,
6 "email" varchar(255) NOT NULL,
7 "status" varchar(32) NOT NULL DEFAULT 'subscribed' CHECK ("status" IN ('subscribed', 'unsubscribed', 'pending', 'bounced')),
8 "source" varchar(100) DEFAULT 'homepage',
9 "unsubscribed_at" timestamp,
10 "user_id" bigint REFERENCES "users"("id"),
11 "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
12 "updated_at" timestamp,
13 "uuid" varchar(255)
14);
15CREATE UNIQUE INDEX IF NOT EXISTS "subscribers_email_unique" ON "subscribers" ("email");
16CREATE UNIQUE INDEX IF NOT EXISTS "subscribers_uuid_unique" ON "subscribers" ("uuid");
17
18CREATE TABLE IF NOT EXISTS "subscriber_emails" (
19 "id" BIGSERIAL PRIMARY KEY,
20 "email" varchar(255) NOT NULL,
21 "source" varchar(100) DEFAULT 'homepage',
22 "subscriber_id" bigint REFERENCES "subscribers"("id"),
23 "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
24 "updated_at" timestamp,
25 "uuid" varchar(255)
26);
27CREATE UNIQUE INDEX IF NOT EXISTS "subscriber_emails_uuid_unique" ON "subscriber_emails" ("uuid");