
DO $$ 
    BEGIN
          IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
        BEGIN
 		ALTER TABLE public."EmailAttachments" ADD "Cid" character varying(512) NULL;
  		UPDATE public."EmailAttachments"SET "Cid" = "Hash";

        EXCEPTION
            WHEN OTHERS THEN RAISE NOTICE 'DROP table <Cid> in <EmailAttachments> error.';
        END;
    END;
$$



