ALTER TABLE CRM_PARAMETRIZACAO ADD IDINTEGRACAOSM VARCHAR2(1) DEFAULT 'N' NOT NULL
/
ALTER TABLE CRM_PARAMETRIZACAO ADD CONSTRAINT CKC_IDINTEGRACAOSM CHECK (IDINTEGRACAOSM IN('S','N'))
/
ALTER TABLE CRM_PARAMETRIZACAO ADD DSREFRESHTOKENRD VARCHAR2(400)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD DSTOKENPUBLICORD VARCHAR2(400)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD DSTOKENPRIVADORD VARCHAR2(400)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD NMEVENTOSCONVERSAO VARCHAR2(4000)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD IDGERATAREFARD VARCHAR2(1) DEFAULT 'N' NOT NULL
/
ALTER TABLE CRM_PARAMETRIZACAO ADD CDOPERRESPONSAVELRD VARCHAR2(12)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD DSDOMINIOSRD VARCHAR2(4000)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD DSCARGOSRD VARCHAR2(4000)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD DSSCORERD VARCHAR2(100)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD 
	CONSTRAINT FKHCM00045OPERADOR FOREIGN KEY (CDOPERRESPONSAVELRD) 
		REFERENCES OPERADOR(CDOPERADOR)
/
ALTER TABLE CRM_PARAMETRIZACAO ADD CONSTRAINT CKC_IDGERATAREFARD CHECK (IDGERATAREFARD IN ('S','N'))
/
CREATE TABLE CRM_CAMPOSRDSTATION 
(
  NRSEQCAMPORDSTATION 		NUMBER 			NOT NULL,
  NMCAMPORDSTATION 		VARCHAR2(30) 		NOT NULL,
  DSCAMPORDSTATION 		VARCHAR2(30) 		NOT NULL,
  NMCAMPO      			VARCHAR2(50) 		NOT NULL,
  NMTABELA     			VARCHAR2(50) 		NOT NULL,
  NMCAMPORELACIONADO  		VARCHAR2(400) 		NULL,
  NMTABELARELACIONADA 		VARCHAR2(400) 		NULL,
  NRORG           			NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg'),
  IDATIVO                    		VARCHAR2(1)     		DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_CRM_CAMPRDSTAT CHECK (IDATIVO IN ('S','N')),
  IDTIPOCAMPORDSTATION 		VARCHAR2(20) 		DEFAULT 'TEXT_INPUT' NOT NULL,
  DSOPCOESCAMPOSELECT 		VARCHAR2(4000) 		NULL,
  IDUUID          			VARCHAR2(4000) 		NOT NULL,
  DTINCLUSAO      			DATE			DEFAULT SYSDATE,
  DTULTATU        			DATE,
  NRORGINCLUSAO   		NUMBER			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg'),
  CDOPERINCLUSAO  		VARCHAR2(12) 		DEFAULT '1',
  NRORGULTATU     			NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg'),
  CDOPERULTATU    		VARCHAR2(12) 		DEFAULT '1'    
)
/
CREATE UNIQUE INDEX PK_CAMPOSRDSTATION ON CRM_CAMPOSRDSTATION (NRSEQCAMPORDSTATION)
/
ALTER TABLE CRM_CAMPOSRDSTATION ADD CONSTRAINT PK_CAMPOSRDSTATION PRIMARY KEY (NRSEQCAMPORDSTATION)
/
ALTER TABLE CRM_CAMPOSRDSTATION 
	ADD CONSTRAINT CKC_IDRTIPOCAMPORD CHECK (IDTIPOCAMPORDSTATION IN ('EMAIL_INPUT', 'NUMBER_INPUT', 'PHONE_INPUT', 'TEXT_INPUT', 'TEXT_AREA', 'URL_INPUT', 'RADIO_BUTTON', 'COMBO_BOX', 'MULTIPLE_CHOICE', 'CHECK_BOX'))
/
CREATE TABLE DES_TIPOFORMACAO 
(	
   NRTIPOFORMACAO 	NUMBER 		NOT NULL,
   DSTIPOFORMACAO 	VARCHAR2(100) 	NOT NULL,
   NRORG                       	NUMBER 		DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_DES_TPFORMA CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO             	DATE                   	NULL,
   DTULTATU                  	DATE                  	NULL,
   NRORGINCLUSAO     	NUMBER             	DEFAULT 1 NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          	NUMBER             	DEFAULT 1 NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1'
)
/
ALTER TABLE DES_TIPOFORMACAO ADD CONSTRAINT PK_DES_TIPOFORMACAO PRIMARY KEY (NRTIPOFORMACAO)
/
ALTER TABLE ESTRUTURAH ADD NRTPOBRIGAPRENDIZ NUMBER
/
ALTER TABLE ESTRUTURAH ADD NRTPOBRIGAPCD NUMBER
/
ALTER TABLE GPE_INTERVALOSHORARIO ADD NRTPINTERVALO NUMBER NULL
/
CREATE INDEX FK_TIPOINTERVALO ON GPE_INTERVALOSHORARIO (NRTPINTERVALO ASC)
/
ALTER TABLE GPE_HORARIOTURNO ADD IDDIAVARIAVEL VARCHAR2(1) DEFAULT 'N' NOT NULL
/
ALTER TABLE GPE_HORARIOTURNO
    	ADD CONSTRAINT CKC_HORTURN_IDDIAVARIAVEL CHECK (IDDIAVARIAVEL IN ('N','S'))