DO $$
	BEGIN
		IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=3399) THEN
			RETURN;
	END IF;

	BEGIN

		BEGIN
		ALTER TABLE public."EventEmailInviteStatus" RENAME CONSTRAINT "EventEmailInviteStatus_pkey" TO "PK_EventEmailInviteStatus";
		EXCEPTION WHEN OTHERS THEN
			NULL;
		END;

		ALTER TABLE public."EventEmailInviteStatus" ADD CONSTRAINT "UIDX_EventEmailInviteStatus" UNIQUE ("MessageId","EventDetailId");
		EXCEPTION
			WHEN OTHERS THEN RAISE NOTICE 'Add UIDX_EventEmailInviteStatus to table EventEmailInviteStatus error.';
		END;
	END;
$$



