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

	BEGIN

		ALTER TABLE public."UserEmailSettings" DROP CONSTRAINT "UserEmailSettings_pkey";
		ALTER TABLE public."UserEmailSettings" ADD CONSTRAINT "UIDX_UserEmailSettings_UserId" UNIQUE ("UserId");

		EXCEPTION
			WHEN OTHERS THEN RAISE NOTICE 'Add UNIQUE to table UserEmailSettings error.';
		END;
	END;
$$

