argos/dmp-db-scema/updates/00.01.005_Add_Dmp_table.sql

45 lines
1.5 KiB
MySQL
Raw Normal View History

DO $$DECLARE
this_version CONSTANT varchar := '00.01.005';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
2023-11-22 12:31:00 +01:00
CREATE TABLE public."Dmp"
(
2023-11-22 12:31:00 +01:00
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",
group_id uuid NOT NULL,
description 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,
creator uuid NOT NULL,
blueprint uuid NOT NULL,
2023-11-24 16:18:28 +01:00
language character varying(100) COLLATE pg_catalog."default",
access_type smallint,
2023-11-22 12:31:00 +01:00
public_after timestamp without time zone,
version_status smallint NOT NULL DEFAULT 1,
CONSTRAINT "Dmp_pkey" PRIMARY KEY (id),
2023-11-22 12:31:00 +01:00
CONSTRAINT "Dmp_blueprint_fkey" FOREIGN KEY (blueprint)
REFERENCES public."DmpBlueprint" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "Dmp_creator_fkey" FOREIGN KEY (creator)
REFERENCES public."UserInfo" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
)
2023-11-22 12:31:00 +01:00
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.005', '2023-10-27 12:00:00.000000+02', now(), 'Add Dmp table.');
END$$;