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

CREATE TABLE IF NOT EXISTS public.UserSettings
(
    id uuid NOT NULL,
    key character varying(500) COLLATE pg_catalog."default" NOT NULL,
    entity_id uuid,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    type character varying(200) COLLATE pg_catalog."default" NOT NULL,
    value text COLLATE pg_catalog."default" NOT NULL,
    name character varying(500) COLLATE pg_catalog."default" NOT NULL,
    CONSTRAINT user_settings_pkey PRIMARY KEY (id)
)


INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.003', '2023-10-19 12:00:00.000000+02', now(), 'Add UserSettings table.');

END$$;