CREATE TABLE APP_USUARIOSERVFIL (
  CDFILCENTPME VARCHAR2(4) DEFAULT NULL NULL, 
  NRUSUARIOSERVFIL NUMBER(10) NOT NULL, 
  CDDIETPAD VARCHAR2(4) DEFAULT NULL NULL, 
  CDCLIENTE VARCHAR2(20) DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORG NUMBER(10) DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  NRUSUARIOCLIFIL NUMBER(10) NOT NULL, 
  CDDESTFILI VARCHAR2(3) DEFAULT NULL NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL, 
  CDTIPOCARD VARCHAR2(10) DEFAULT NULL NULL, 
  CDSERVFILI VARCHAR2(5) NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_APP_USUARIOSERVFIL PRIMARY KEY(NRUSUARIOSERVFIL)
)
/
ALTER TABLE APP_USUARIOSERVFIL ADD CONSTRAINT CKC_IDATIVO_APP_USUARIOSERVFIL CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE APP_USUARIOSERVFIL ADD CONSTRAINT FKMYM00028USUARIOCLIFIL FOREIGN KEY (NRUSUARIOCLIFIL) REFERENCES APP_USUARIOCLIFIL (NRUSUARIOCLIFIL) ON DELETE CASCADE
/
CREATE INDEX FKMYM00028USUARIOCLIFIL ON APP_USUARIOSERVFIL(NRUSUARIOCLIFIL)
/
ALTER TABLE APP_USUARIOSERVFIL ADD CONSTRAINT FKMYM00029TIPOCARD FOREIGN KEY (CDFILCENTPME, CDTIPOCARD) REFERENCES TIPOCARD (CDFILCENTPME, CDTIPOCARD)  ON DELETE SET NULL
/
CREATE INDEX FKMYM00029TIPOCARD ON APP_USUARIOSERVFIL(CDFILCENTPME, CDTIPOCARD)
/
CREATE TABLE AVALIACAOPRATO (
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL, 
  NRUSUARIOAPP NUMBER(10) DEFAULT NULL NULL, 
  CDTIPOCARD VARCHAR2(10) DEFAULT NULL NULL, 
  CDSERVFILI VARCHAR2(5) NOT NULL, 
  CDDIETPAD VARCHAR2(3) DEFAULT NULL NULL, 
  CDPRATO VARCHAR2(10) NOT NULL, 
  DTCARDAPIO DATE DEFAULT NULL NULL, 
  NRAVALIACAOPRATO NUMBER(10) NOT NULL, 
  CDFILCENTPME VARCHAR2(4) DEFAULT NULL NULL, 
  NRCARDPME VARCHAR2(10) DEFAULT NULL NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  NRCARDAPIO VARCHAR2(10) NOT NULL, 
  NRSEQPRATCAR VARCHAR2(3) DEFAULT NULL NULL, 
  CDFILAUXPRAT VARCHAR2(4) NOT NULL, 
  CDTIPOPRAT VARCHAR2(2) DEFAULT NULL NULL, 
  VRAVALIACAOPRATO DOUBLE PRECISION DEFAULT NULL NULL, 
  DSAVALIACAOPRATO VARCHAR2(2000) DEFAULT NULL NULL, 
  NRORG NUMBER(10) DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_AVALIACAOPRATO PRIMARY KEY(NRAVALIACAOPRATO)
)
/
ALTER TABLE AVALIACAOPRATO ADD CONSTRAINT CKC_IDATIVO_AVALIACAOPRATO CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE QRCODELOCALPESQ ADD IDPERANON VARCHAR2(1) DEFAULT 'N' NOT NULL
/
ALTER TABLE QRCODELOCALPESQ ADD CONSTRAINT CKC_IDPERANON_QRCODELOCALPESQ CHECK(IDPERANON IN ('S','N'))