argos/dmp-db-scema/updates/00.01.007_Add_Description_t...

30 lines
1.3 KiB
MySQL
Raw Normal View History

DO $$DECLARE
this_version CONSTANT varchar := '00.01.007';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE IF NOT EXISTS public."Description"
(
"id" uuid NOT NULL,
"label" character varying(250) COLLATE pg_catalog."default" NOT NULL,
"dmp" uuid,
"uri" character varying(250) COLLATE pg_catalog."default",
"properties" text COLLATE pg_catalog."default",
"profile" uuid,
"reference" text COLLATE pg_catalog."default",
"status" smallint NOT NULL DEFAULT 0,
"description" text COLLATE pg_catalog."default",
"dmp_section_index" integer 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,
"finalized_at" timestamp without time zone,
CONSTRAINT "Description_pkey" PRIMARY KEY (id),
CONSTRAINT "Description_dmp_fkey" FOREIGN KEY ("dmp") REFERENCES public."Dmp"("id"),
CONSTRAINT "Description_profile_fkey" FOREIGN KEY ("profile") REFERENCES public."DescriptionTemplate"("ID")
2023-11-22 12:31:00 +01:00
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.007', '2023-10-27 12:00:00.000000+02', now(), 'Add Description table (former Dataset).');
END$$;