23 lines
1004 B
SQL
23 lines
1004 B
SQL
DO $$DECLARE
|
|
this_version CONSTANT varchar := '00.01.008';
|
|
BEGIN
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
CREATE TABLE IF NOT EXISTS public."DescriptionReference"
|
|
(
|
|
"id" uuid NOT NULL,
|
|
"data" text COLLATE pg_catalog."default" NOT NULL,
|
|
"description_id" uuid NOT NULL,
|
|
"reference_id" uuid NOT NULL,
|
|
"created_at" timestamp without time zone NOT NULL DEFAULT now(),
|
|
"updated_at" timestamp without time zone NOT NULL DEFAULT now(),
|
|
"is_active" smallint NOT NULL DEFAULT 1,
|
|
CONSTRAINT "DescriptionReference_pkey" PRIMARY KEY (id),
|
|
CONSTRAINT "DescriptionReference_description_fkey" FOREIGN KEY ("description_id") REFERENCES public."Description"("id"),
|
|
CONSTRAINT "DescriptionReference_reference_fkey" FOREIGN KEY ("reference_id") REFERENCES public."Reference"("id")
|
|
)
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.008', '2023-10-27 12:00:00.000000+02', now(), 'Add DescriptionReference table.');
|
|
|
|
END$$; |