ALTER TABLE VCLib.T_USER_CONTEXTS ADD COLUMN "readonlystate" integer NULL;

UPDATE VCLib.T_USER_CONTEXTS 
SET "readonlystate" = ("readonly")::int;

ALTER TABLE VCLib.T_USER_CONTEXTS ALTER COLUMN "readonlystate" SET NOT NULL;

ALTER TABLE VCLib.T_USER_CONTEXTS DROP COLUMN IF EXISTS readonly;