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

DROP TABLE public."DatasetProfileViewstyle";

DROP TABLE public."DatasetProfileRuleset";

INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.009', '2023-10-27 12:00:00.000000+02', now(), 'Drop old dataset related tables.');

END$$;