argos/dmp-db-scema/updates/00.01.027_renameOldNotifica...

18 lines
643 B
MySQL
Raw Permalink Normal View History

2023-12-05 10:56:25 +01:00
DO $$DECLARE
this_version CONSTANT varchar := '00.01.027';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
ALTER TABLE public."Notification"
RENAME TO "NotificationLegacy";
ALTER TABLE public."NotificationLegacy"
RENAME CONSTRAINT "Notification_pkey" TO "NotificationLegacy_pkey";
ALTER TABLE public."NotificationLegacy"
RENAME CONSTRAINT "Notification_UserId_fkey" TO "NotificationLegacy_UserId_fkey";
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.027', '2023-12-05 12:00:00.000000+02', now(), 'Rename table Notification to NotificationLegacy.');
END$$;