diff --git a/dmp-db-scema/updates/00.01.005_Add_Dmp_table.sql b/dmp-db-scema/updates/00.01.005_Add_Dmp_table.sql index 02de486e5..d8c16638c 100644 --- a/dmp-db-scema/updates/00.01.005_Add_Dmp_table.sql +++ b/dmp-db-scema/updates/00.01.005_Add_Dmp_table.sql @@ -21,7 +21,8 @@ CREATE TABLE IF NOT EXISTS public."Dmp" "is_active" smallint NOT NULL DEFAULT 1, "finalized_at" timestamp without time zone, "published_at" timestamp without time zone, - CONSTRAINT "Dmp_pkey" PRIMARY KEY (id) + CONSTRAINT "Dmp_pkey" PRIMARY KEY (id), + CONSTRAINT "Dmp_creator_fkey" FOREIGN KEY (creator) REFERENCES public."UserInfo" (id) ) INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.005', '2023-10-27 12:00:00.000000+02', now(), 'Add Dmp table.'); diff --git a/dmp-db-scema/updates/00.01.009_Drop_old_dataset_related_tables.sql b/dmp-db-scema/updates/00.01.009_Drop_old_dataset_related_tables.sql new file mode 100644 index 000000000..7c210623c --- /dev/null +++ b/dmp-db-scema/updates/00.01.009_Drop_old_dataset_related_tables.sql @@ -0,0 +1,13 @@ +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$$; \ No newline at end of file