ALTER TABLE FCT_PARAMETROGERAL ADD URLINTEGRACAOTECFOOD VARCHAR2(4000)
/

ALTER TABLE FCT_MODELOCONTRATO ADD IDINTEGRACAOTECFOOD CHAR(1)
/

ALTER TABLE FCT_MODELOCONTRATO ADD CONSTRAINT CKC_IDINTEGRACAOTECFOOD CHECK (IDINTEGRACAOTECFOOD IN ('S', 'N'))
/

UPDATE FCT_MODELOCONTRATO
   SET IDINTEGRACAOTECFOOD = 'N'
 WHERE IDINTEGRACAOTECFOOD IS NULL
/
COMMIT
/
 
 
ALTER TABLE FCT_MODELOCONTRATO ADD IDTIPOSERVINTTECFOOD CHAR(1)
/

ALTER TABLE FCT_MODELOCONTRATO ADD CONSTRAINT CKC_IDTIPOSERVINTTECFOOD
	CHECK (IDTIPOSERVINTTECFOOD IS NULL OR IDTIPOSERVINTTECFOOD IN ('N','D','A','M','F'))
/

ALTER TABLE FCT_CONTRATO ADD IDINTEGRACAOTECFOOD CHAR(1)
/

ALTER TABLE FCT_CONTRATO ADD CONSTRAINT CKC_IDINTEGRACAOTECFOOD_CONT
	CHECK (IDINTEGRACAOTECFOOD IN ('S', 'N'))
/

UPDATE FCT_CONTRATO
   SET IDINTEGRACAOTECFOOD = 'N'
 WHERE IDINTEGRACAOTECFOOD IS NULL
/
COMMIT
/
 
ALTER TABLE FCT_CONTRATO ADD IDTIPOSERVINTTECFOOD CHAR(1)
/

ALTER TABLE FCT_CONTRATO ADD CONSTRAINT CKC_IDTIPOSERVINTTECFOOD_CONT 
	CHECK (IDTIPOSERVINTTECFOOD IS NULL OR IDTIPOSERVINTTECFOOD IN ('N','D','A','M','F'))
/

ALTER TABLE FCT_ITEMCONTRATO ADD CDGRUPSERVINTTECFOOD VARCHAR2(3)
/

ALTER TABLE FCT_ITEMCONTRATO ADD HRINIPREPSERVINTTECFOOD VARCHAR2(5)
/

ALTER TABLE FCT_ITEMCONTRATO ADD CDFILIALTECFOOD VARCHAR2(4)
/

ALTER TABLE FCT_ITEMCONTRATO ADD CDSERVFILITECFOOD VARCHAR2(5)
/

ALTER TABLE FCT_ITEMCONTRATO
   ADD CONSTRAINT FKSM00414SERVICO_FCT_ITEMCONT FOREIGN KEY (CDFILIALTECFOOD, CDSERVFILITECFOOD)
      REFERENCES SERVICO (CDFILIAL, CDSERVFILI)
/

CREATE INDEX SM00414_FK ON FCT_ITEMCONTRATO(CDFILIALTECFOOD ASC, CDSERVFILITECFOOD ASC)
/

CREATE  TABLE FCT_LOGINTEGRATECFOOD (  
	NRLOGINTEGRATECFOOD NUMBER NOT NULL, 
	NRSEQCONTRATO	    NUMBER,
	NRITEMOCONTRATO     NUMBER,
	NRESTRUTURAM 	    NUMBER, 
	DSETAPA 		    VARCHAR2 (1000), 
	DSMOTIVO 		    VARCHAR2 (4000), 
	NRORG               NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO             VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO          DATE            DEFAULT SYSDATE,
    DTULTATU            DATE            DEFAULT SYSDATE,
    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',
	CONSTRAINT CKC_IDATIVO_FCT_LOGINTEGTECFOD CHECK (IDATIVO IN ('S','N'))
 )
/

ALTER TABLE FCT_LOGINTEGRATECFOOD ADD CONSTRAINT PK_FCT_LOGINTEGRATECFOOD 
	PRIMARY KEY (NRLOGINTEGRATECFOOD)
/