DO $$DECLARE this_version CONSTANT varchar := '00.01.005'; BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; CREATE TABLE IF NOT EXISTS public."Dmp" ( "id" uuid NOT NULL, "label" character varying(250) COLLATE pg_catalog."default" NOT NULL, "version" integer NOT NULL, "status" smallint NOT NULL DEFAULT 0, "properties" text COLLATE pg_catalog."default", "dmp_properties" text COLLATE pg_catalog."default", "group_id" uuid, "description" text COLLATE pg_catalog."default", "is_public" boolean NOT NULL DEFAULT false, "extra_properties" text COLLATE pg_catalog."default", "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, "published_at" timestamp without time zone, CONSTRAINT "Dmp_pkey" PRIMARY KEY (id), CONSTRAINT "Dmp_creator_fkey" FOREIGN KEY (creator) REFERENCES public."UserInfo" (id) ) INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.005', '2023-10-27 12:00:00.000000+02', now(), 'Add Dmp table.'); END$$;