From e1780128441c45e9b665c71cd6fd75030bb7b72c Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Wed, 26 Jun 2024 11:34:08 +0300 Subject: [PATCH] Remove unused tables --- .../updates/00.02.000_RemoveUnusedTables.sql | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 dmp-db-scema/updates/00.02.000_RemoveUnusedTables.sql diff --git a/dmp-db-scema/updates/00.02.000_RemoveUnusedTables.sql b/dmp-db-scema/updates/00.02.000_RemoveUnusedTables.sql new file mode 100644 index 000000000..7a950e3ab --- /dev/null +++ b/dmp-db-scema/updates/00.02.000_RemoveUnusedTables.sql @@ -0,0 +1,43 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.02.000'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + DROP TABLE public."DatasetDataRepository"; + DROP TABLE public."DatasetExternalDataset"; + DROP TABLE public."DatasetRegistry"; + DROP TABLE public."DatasetService"; + DROP TABLE public."Dataset"; + + DROP TABLE public."DMPDatasetProfile"; + DROP TABLE public."DMPOrganisation"; + DROP TABLE public."DMPResearcher"; + DROP TABLE public."UserDMP"; + DROP TABLE public."Invitation"; + DROP TABLE public."DMP"; + + DROP TABLE public."DoiFunder"; + + DROP TABLE public."DataRepository"; + DROP TABLE public."ExternalDataset"; + DROP TABLE public."Project"; + DROP TABLE public."Funder"; + DROP TABLE public."Grant"; + DROP TABLE public."Organisation"; + DROP TABLE public."Registry"; + DROP TABLE public."Researcher"; + DROP TABLE public."Service"; + + DROP TABLE public."Content"; + DROP TABLE public."Credential"; + DROP TABLE public."EmailConfirmation"; + DROP TABLE public."FileUpload"; + DROP TABLE public."NotificationLegacy"; + DROP TABLE public."UserAssociation"; + DROP TABLE public."UserToken"; + DROP TABLE public."UserInfo"; + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.02.000', '2024-06-26 12:00:00.000000+02', now(), 'Remove unused tables.'); + +END$$; \ No newline at end of file