--------------------------------------------------------------------------
-- Play this script in PRUEBAS@VISANY to make it look like DESA@VISMAR
--                                                                      --
-- Please review the script before using it to make sure it won't       --
-- cause any unacceptable data loss.                                    --
--                                                                      --
-- PRUEBAS@VISANY Schema Extracted by User PRUEBAS 
-- DESA@VISMAR Schema Extracted by User DESA 
---DROP CONSTRAINT CMSCOMCOBRO_ACUAFIL_FK;
ALTER TABLE CMSACUAFIL
   ADD CONSTRAINT CMSCOMCOBRO_ACUAFIL_FK FOREIGN KEY (CIA)
      REFERENCES CMSCOMCOBRO (CIA);

---DROP CONSTRAINT CMSCOMCOBRO_ACUKLM_FK;
ALTER TABLE CMSACUKLM
   ADD CONSTRAINT CMSCOMCOBRO_ACUKLM_FK FOREIGN KEY (CIA)
      REFERENCES CMSCOMCOBRO (CIA);

---DROP CONSTRAINT CMSPARAMETROS_ADELANTO_FK;
ALTER TABLE CMSADELANTO
ADD CONSTRAINT CMSPARAMETROS_ADELANTO_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

---DROP CONSTRAINT CMSPARAMETROS_AUMENTO_FK;
ALTER TABLE CMSAUMENTO
ADD CONSTRAINT CMSPARAMETROS_AUMENTO_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

---DROP CONSTRAINT CMSMAESTRO_COMCOBRO_FK;
ALTER TABLE CMSCOMCOBRO
ADD CONSTRAINT CMSMAESTRO_COMCOBRO_FK FOREIGN KEY (CIA, COMCOBRO)
      REFERENCES CMSMAESTRO (CIA, COMISION);

---DROP CONSTRAINT CMSCOMCOBROESC_PORCENTAJE_CK;
ALTER TABLE CMSCOMCOBROESC ADD
CONSTRAINT CMSCOMCOBROESC_PORCENTAJE_CK CHECK (PORCENTAJE >= 0);

---DROP CONSTRAINT CMSCOMCOBRO_ESC_FK;
ALTER TABLE CMSCOMCOBROESC
ADD CONSTRAINT CMSCOMCOBRO_ESC_FK FOREIGN KEY (CIA)
      REFERENCES CMSCOMCOBRO (CIA);

---DROP CONSTRAINT CMSTABLA_DETTABLA_FK;
ALTER TABLE CMSDETTABLA
ADD CONSTRAINT CMSTABLA_DETTABLA_FK FOREIGN KEY (CIA, TABLA)
      REFERENCES CMSTABLA (CIA, TABLA);

---DROP CONSTRAINT CMSMAESTRO_DIRECTA_FK;
ALTER TABLE CMSDIRECTA
   ADD CONSTRAINT CMSMAESTRO_DIRECTA_FK FOREIGN KEY (CIA, COMISION)
      REFERENCES CMSMAESTRO (CIA, COMISION);

---DROP CONSTRAINT CMSMAESTRO_INDPUESTO_FK;
ALTER TABLE CMSINDPUESTO
  ADD CONSTRAINT CMSMAESTRO_INDPUESTO_FK FOREIGN KEY (CIA, COMISION)
      REFERENCES CMSMAESTRO (CIA, COMISION);

---DROP CONSTRAINT CMSMAESTRO_INDVENTAS_FK;
ALTER TABLE CMSINDVENTAS
   ADD CONSTRAINT CMSMAESTRO_INDVENTAS_FK FOREIGN KEY (CIA, COMISION)
      REFERENCES CMSMAESTRO (CIA, COMISION);

---DROP CONSTRAINT CMSPARAMETROS_JEFESDEPTO_FK;
ALTER TABLE CMSJEFESDEPTOS
  ADD CONSTRAINT CMSPARAMETROS_JEFESDEPTO_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

---DROP CONSTRAINT CMSTABLA_JEFES_FK;
ALTER TABLE CMSJEFESTABLA
   ADD CONSTRAINT CMSTABLA_JEFES_FK FOREIGN KEY (CIA, TABLA)
      REFERENCES CMSTABLA (CIA, TABLA);

---DROP CONSTRAINT CMSPARAMETROS_LABORES_FK;
ALTER TABLE CMSLABORES
   ADD CONSTRAINT CMSPARAMETROS_LABORES_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

---DROP CONSTRAINT CMSPARAMETROS_VARIOS_FK;
ALTER TABLE CMSMAESTRO
   ADD CONSTRAINT CMSPARAMETROS_VARIOS_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

---DROP CONSTRAINT CMSPARAMETROS_MONTOS_FK;
ALTER TABLE CMSMONTOS
ADD CONSTRAINT CMSPARAMETROS_MONTOS_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

---DROP CONSTRAINT CMSCOMCOBRO_PREAFIL_FK;
ALTER TABLE CMSPREAFIL
   ADD CONSTRAINT CMSCOMCOBRO_PREAFIL_FK FOREIGN KEY (CIA)
      REFERENCES CMSCOMCOBRO (CIA);

---DROP CONSTRAINT CMSPARAMETROS_TABLA_FK;
ALTER TABLE CMSTABLA
  ADD CONSTRAINT CMSPARAMETROS_TABLA_FK FOREIGN KEY (CIA)
      REFERENCES CMSPARAMETROS (CIA);

ALTER TABLE CMSACUAFIL
MODIFY(VENCE  DEFAULT SYSDATE);