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

        CREATE TABLE public."Tenant"
        (
            id uuid NOT NULL,
            name character varying(200) NOT NULL,
            code character varying(500) NOT NULL,
            description character varying NOT NULL,
            config text,
            is_active smallint NOT NULL,
            created_at timestamp without time zone NOT NULL,
            updated_at timestamp without time zone NOT NULL,
            PRIMARY KEY (id)
        )
        WITH (
            OIDS = FALSE
        );

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

END$$;