diff --git a/server/setup/scriptsPg/1.12.0.ts b/server/setup/scriptsPg/1.12.0.ts index 7f07694c..d5bf2bcc 100644 --- a/server/setup/scriptsPg/1.12.0.ts +++ b/server/setup/scriptsPg/1.12.0.ts @@ -79,6 +79,21 @@ export default async function migration() { ); `); + await db.execute(sql` + CREATE TABLE "blueprints" ( + "blueprintId" serial PRIMARY KEY NOT NULL, + "orgId" text NOT NULL, + "name" varchar NOT NULL, + "source" varchar NOT NULL, + "createdAt" integer NOT NULL, + "succeeded" boolean NOT NULL, + "contents" text NOT NULL, + "message" text + ); + `); + + await db.execute(sql`ALTER TABLE "blueprints" ADD CONSTRAINT "blueprints_orgId_orgs_orgId_fk" FOREIGN KEY ("orgId") REFERENCES "public"."orgs"("orgId") ON DELETE cascade ON UPDATE no action;`); + await db.execute(sql`ALTER TABLE "resources" DROP CONSTRAINT "resources_skipToIdpId_idp_idpId_fk";`); await db.execute(sql`ALTER TABLE "domains" ADD COLUMN "certResolver" varchar;`); await db.execute(sql`ALTER TABLE "domains" ADD COLUMN "customCertResolver" varchar;`); diff --git a/server/setup/scriptsSqlite/1.12.0.ts b/server/setup/scriptsSqlite/1.12.0.ts index d8a679b0..19ea2892 100644 --- a/server/setup/scriptsSqlite/1.12.0.ts +++ b/server/setup/scriptsSqlite/1.12.0.ts @@ -112,6 +112,23 @@ export default async function migration() { ` ).run(); + + db.prepare( + ` + CREATE TABLE 'blueprints' ( + 'blueprintId' integer PRIMARY KEY AUTOINCREMENT NOT NULL, + 'orgId' text NOT NULL, + 'name' text NOT NULL, + 'source' text NOT NULL, + 'createdAt' integer NOT NULL, + 'succeeded' integer NOT NULL, + 'contents' text NOT NULL, + 'message' text, + FOREIGN KEY ('orgId') REFERENCES 'orgs'('orgId') ON UPDATE no action ON DELETE cascade + ); + ` + ).run(); + db.prepare( `CREATE INDEX 'idx_requestAuditLog_timestamp' ON 'requestAuditLog' ('timestamp');` ).run();