Skip to content

Instantly share code, notes, and snippets.

@viperfx
Created September 23, 2021 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viperfx/22c399650bf9c191cad51d9b44442589 to your computer and use it in GitHub Desktop.
Save viperfx/22c399650bf9c191cad51d9b44442589 to your computer and use it in GitHub Desktop.
Forrest SQL
-- Table: public._ChangelogEntryToRoadmapItem
-- DROP TABLE public."_ChangelogEntryToRoadmapItem";
CREATE TABLE public."_ChangelogEntryToRoadmapItem"
(
"A" text COLLATE pg_catalog."default" NOT NULL,
"B" text COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT "_ChangelogEntryToRoadmapItem_A_fkey" FOREIGN KEY ("A")
REFERENCES public."ChangelogEntry" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT "_ChangelogEntryToRoadmapItem_B_fkey" FOREIGN KEY ("B")
REFERENCES public."RoadmapItem" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
)
TABLESPACE pg_default;
ALTER TABLE public."_ChangelogEntryToRoadmapItem"
OWNER to postgres;
-- Index: _ChangelogEntryToRoadmapItem_AB_unique
-- DROP INDEX public."_ChangelogEntryToRoadmapItem_AB_unique";
CREATE UNIQUE INDEX "_ChangelogEntryToRoadmapItem_AB_unique"
ON public."_ChangelogEntryToRoadmapItem" USING btree
("A" COLLATE pg_catalog."default" ASC NULLS LAST, "B" COLLATE pg_catalog."default" ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: _ChangelogEntryToRoadmapItem_B_index
-- DROP INDEX public."_ChangelogEntryToRoadmapItem_B_index";
CREATE INDEX "_ChangelogEntryToRoadmapItem_B_index"
ON public."_ChangelogEntryToRoadmapItem" USING btree
("B" COLLATE pg_catalog."default" ASC NULLS LAST)
TABLESPACE pg_default;
-- Table: public.ChangelogEntry
-- DROP TABLE public."ChangelogEntry";
CREATE TABLE public."ChangelogEntry"
(
id text COLLATE pg_catalog."default" NOT NULL,
title text COLLATE pg_catalog."default" NOT NULL,
slug text COLLATE pg_catalog."default" NOT NULL,
"desc" text COLLATE pg_catalog."default",
status "ChangelogStatus" NOT NULL DEFAULT 'DRAFT'::"ChangelogStatus",
"teamId" text COLLATE pg_catalog."default" NOT NULL,
"createdAt" timestamp(3) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" timestamp(3) without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"publishAt" timestamp(3) without time zone,
type "ChangelogType",
"heroImage" text COLLATE pg_catalog."default",
"createdById" text COLLATE pg_catalog."default",
"number" integer NOT NULL DEFAULT 0,
"createdByMemberId" text COLLATE pg_catalog."default",
"isDemo" boolean NOT NULL DEFAULT false,
CONSTRAINT "ChangelogEntry_pkey" PRIMARY KEY (id),
CONSTRAINT "ChangelogEntry_createdById_fkey" FOREIGN KEY ("createdById")
REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE SET NULL,
CONSTRAINT "ChangelogEntry_createdByMemberId_fkey" FOREIGN KEY ("createdByMemberId")
REFERENCES public."Membership" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE SET NULL,
CONSTRAINT "ChangelogEntry_teamId_fkey" FOREIGN KEY ("teamId")
REFERENCES public."Team" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
)
TABLESPACE pg_default;
ALTER TABLE public."ChangelogEntry"
OWNER to postgres;
-- Index: ChangelogEntry.number_teamId_unique
-- DROP INDEX public."ChangelogEntry.number_teamId_unique";
CREATE UNIQUE INDEX "ChangelogEntry.number_teamId_unique"
ON public."ChangelogEntry" USING btree
(number ASC NULLS LAST, "teamId" COLLATE pg_catalog."default" ASC NULLS LAST)
TABLESPACE pg_default;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment