ALTER TABLE FCM_PERFILACESSO ADD IDDIRECIONAQRCODE CHAR(1) DEFAULT 'T' NOT NULL
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDDIRECIONAQRCODE CHECK (IDDIRECIONAQRCODE IN ('T', 'V'))
/

ALTER TABLE FCM_PERFILACESSO ADD IDTIPODASHBOARD CHAR(1) DEFAULT 'O' NOT NULL
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDTIPODASHBOARD CHECK (IDTIPODASHBOARD IN ('O', 'S', 'G'))
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSFUNCOES
/

ALTER TABLE FCM_PERFILACESSO DROP COLUMN IDPERMISSSFUNCOES
/


ALTER TABLE FCM_PERFILACESSO ADD IDPERMISSSVISTORIA CHAR(1) DEFAULT 'E' NOT NULL
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSVISTORIA CHECK (IDPERMISSSVISTORIA IN ('V', 'E', 'N'))
/


ALTER TABLE FCM_PERFILACESSO ADD IDPERMISSSCALEND CHAR(1) DEFAULT 'E' NOT NULL
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSCALEND CHECK (IDPERMISSSCALEND IN ('V', 'E', 'N'))
/


UPDATE FCM_PERFILACESSO
   SET IDPERMISSSUSUARIO = 'E'
 WHERE IDPERMISSSUSUARIO = 'A'
/

ALTER TABLE FCM_PERFILACESSO MODIFY IDPERMISSSUSUARIO DEFAULT 'E'
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSUSUARIO
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSUSUARIO CHECK (IDPERMISSSUSUARIO IN ('V', 'E', 'N'))
/


UPDATE FCM_PERFILACESSO
   SET IDPERMISSSTAREFAS = 'E'
 WHERE IDPERMISSSTAREFAS = 'A'
/

ALTER TABLE FCM_PERFILACESSO MODIFY IDPERMISSSTAREFAS DEFAULT 'E'
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSTAREFAS
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSTAREFAS CHECK (IDPERMISSSTAREFAS IN ('V', 'E', 'N'))
/


UPDATE FCM_PERFILACESSO
   SET IDPERMISSSLOCAIS = 'E'
 WHERE IDPERMISSSLOCAIS = 'A'
/

ALTER TABLE FCM_PERFILACESSO MODIFY IDPERMISSSLOCAIS DEFAULT 'E'
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSLOCAIS
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSLOCAIS CHECK (IDPERMISSSLOCAIS IN ('V', 'E', 'N'))
/

UPDATE FCM_PERFILACESSO
   SET IDPERMISSSCHECKLIST = 'E'
 WHERE IDPERMISSSCHECKLIST = 'A'
/

ALTER TABLE FCM_PERFILACESSO MODIFY IDPERMISSSCHECKLIST DEFAULT 'E'
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSCHECKLIST
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSCHECKLIST CHECK (IDPERMISSSCHECKLIST IN ('V', 'E', 'N'))
/

UPDATE FCM_PERFILACESSO
   SET IDPERMISSSRELATORIOS = 'E'
 WHERE IDPERMISSSRELATORIOS = 'A'
/

ALTER TABLE FCM_PERFILACESSO MODIFY IDPERMISSSRELATORIOS DEFAULT 'E'
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSRELATORIOS
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSRELATORIOS CHECK (IDPERMISSSRELATORIOS IN ('V', 'E', 'N'))
/


UPDATE FCM_PERFILACESSO
   SET IDPERMISSSGRAFICOS = 'E'
 WHERE IDPERMISSSGRAFICOS = 'A'
/

ALTER TABLE FCM_PERFILACESSO MODIFY IDPERMISSSGRAFICOS DEFAULT 'E'
/

ALTER TABLE FCM_PERFILACESSO DROP CONSTRAINT CHK_IDPERMISSSGRAFICOS
/

ALTER TABLE FCM_PERFILACESSO ADD CONSTRAINT CHK_IDPERMISSSGRAFICOS CHECK (IDPERMISSSGRAFICOS IN ('V', 'E', 'N'))
/

DROP TABLE FCM_FOTOTAREFAGERCHK
/

CREATE TABLE FCM_FOTOTAREFAGERCHK (
  NRFOTOTAREFAGERCHK  	NUMBER  		NOT NULL,
  NRTAREFAGERCHK      	NUMBER  		NOT NULL,
  DSFOTOTAREFAGERCHK  	VARCHAR2(1000)  NOT NULL,
  NRORG             	NUMBER 	     	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
  IDATIVO           	VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
      CONSTRAINT CHK_IDATIVO_FCM_FOTOTARCHK CHECK (IDATIVO IN ('S','N')),
  DTINCLUSAO        	DATE 			NULL,
  DTULTATU          	DATE            NULL,
  NRORGINCLUSAO     	NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
  CDOPERINCLUSAO    	VARCHAR2(12)    DEFAULT '1' 					NULL,
  NRORGULTATU       	NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
  CDOPERULTATU      	VARCHAR2(12)    DEFAULT '1'

)
/

ALTER TABLE FCM_FOTOTAREFAGERCHK ADD CONSTRAINT PK_FCM_FOTOTAREFAGERCHK PRIMARY KEY (NRFOTOTAREFAGERCHK)
/

CREATE INDEX FCM00055_FK ON FCM_FOTOTAREFAGERCHK (NRTAREFAGERCHK ASC)
/

ALTER TABLE FCM_FOTOTAREFAGERCHK 
  ADD CONSTRAINT FKFCM00055TARCHK_FOTOTARCHK FOREIGN KEY (NRTAREFAGERCHK)
      REFERENCES FCM_TAREFAGERCHK (NRTAREFAGERCHK)
/

ALTER TABLE FCM_GERENCIAMENTOCHK MODIFY NRFUNCIONARIO NULL
/

ALTER TABLE FCM_TAREFAGERCHK MODIFY NRFUNCIONARIO NULL
/

ALTER TABLE FCM_TAREFAAGEND MODIFY NRFUNCIONARIO NULL
/

ALTER TABLE FCM_CHECKLISTAGEND MODIFY NRFUNCIONARIO NULL
/