-- Remove size limitations of text fields.

ALTER TABLE USERS ALTER COLUMN EMAIL TYPE TEXT;
ALTER TABLE USERS ALTER COLUMN USER_CODE TYPE TEXT;
ALTER TABLE USERS ALTER COLUMN FULL_NAME TYPE TEXT;
ALTER TABLE FILES ALTER COLUMN NAME TYPE TEXT;
ALTER TABLE FILES ALTER COLUMN PATH TYPE TEXT;
ALTER TABLE FILES ALTER COLUMN COMMENT TYPE TEXT;
ALTER TABLE FILES ALTER COLUMN REGISTRATOR_CODE TYPE TEXT;
ALTER TABLE FILES ALTER COLUMN CONTENT_TYPE TYPE TEXT;
 
DROP DOMAIN COMMENT;
DROP DOMAIN CONTENT_TYPE;
DROP DOMAIN FILE_NAME;
DROP DOMAIN OBJECT_NAME;
DROP DOMAIN PATH_NAME;
DROP DOMAIN USER_CODE;
 
CREATE DOMAIN COMMENT AS TEXT;
CREATE DOMAIN CONTENT_TYPE AS TEXT;
CREATE DOMAIN FILE_NAME AS TEXT;
CREATE DOMAIN OBJECT_NAME AS TEXT;
CREATE DOMAIN PATH_NAME AS TEXT;
CREATE DOMAIN USER_CODE AS TEXT;

ALTER TABLE USERS ALTER COLUMN EMAIL TYPE OBJECT_NAME;
ALTER TABLE USERS ALTER COLUMN USER_CODE TYPE USER_CODE;
ALTER TABLE USERS ALTER COLUMN FULL_NAME TYPE OBJECT_NAME;
ALTER TABLE FILES ALTER COLUMN NAME TYPE FILE_NAME;
ALTER TABLE FILES ALTER COLUMN PATH TYPE PATH_NAME;
ALTER TABLE FILES ALTER COLUMN COMMENT TYPE COMMENT;
ALTER TABLE FILES ALTER COLUMN REGISTRATOR_CODE TYPE USER_CODE;
ALTER TABLE FILES ALTER COLUMN CONTENT_TYPE TYPE CONTENT_TYPE;
