DO $$DECLARE
   this_version CONSTANT varchar := '00.01.019';
BEGIN
   PERFORM * FROM "DBVersion" WHERE version = this_version;
   IF FOUND THEN RETURN; END IF;

        CREATE TABLE public."UserContactInfo"
        (
            id uuid NOT NULL,
            "user" uuid NOT NULL,
            ordinal integer NOT NULL DEFAULT 0,
            type smallint NOT NULL,
            value character varying(512) NOT NULL,
            created_at timestamp without time zone NOT NULL,
            PRIMARY KEY (id),
            FOREIGN KEY ("user")
                REFERENCES public."User" (id) MATCH SIMPLE
                ON UPDATE NO ACTION
                ON DELETE NO ACTION
                NOT VALID
        )
        WITH (
            OIDS = FALSE
        );

INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.019', '2023-11-20 12:00:00.000000+02', now(), 'Add table UserContactInfo.');

END$$;