DROP TABLE IF EXISTS `vtiger_projecttasktype_seq`;
CREATE TABLE `vtiger_projecttasktype_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projecttype`;
CREATE TABLE `vtiger_projecttype` (
  `projecttypeid` int(10) NOT NULL AUTO_INCREMENT,
  `projecttype` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`projecttypeid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projecttype_seq`;
CREATE TABLE `vtiger_projecttype_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_propiedad`;
CREATE TABLE `vtiger_propiedad` (
  `propiedadid` int(11) NOT NULL AUTO_INCREMENT,
  `propiedad` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`propiedadid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_proviene`;
CREATE TABLE `vtiger_proviene` (
  `provieneid` int(11) NOT NULL AUTO_INCREMENT,
  `proviene` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provieneid`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provienede`;
CREATE TABLE `vtiger_provienede` (
  `provienedeid` int(11) NOT NULL AUTO_INCREMENT,
  `provienede` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provienedeid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provincia`;
CREATE TABLE `vtiger_provincia` (
  `provinciaid` int(11) NOT NULL AUTO_INCREMENT,
  `provincia` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciaid`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provinciabi1`;
CREATE TABLE `vtiger_provinciabi1` (
  `provinciabi1id` int(11) NOT NULL AUTO_INCREMENT,
  `provinciabi1` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciabi1id`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provinciabi2`;
CREATE TABLE `vtiger_provinciabi2` (
  `provinciabi2id` int(11) NOT NULL AUTO_INCREMENT,
  `provinciabi2` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciabi2id`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provinciacli`;
CREATE TABLE `vtiger_provinciacli` (
  `provinciacliid` int(11) NOT NULL AUTO_INCREMENT,
  `provinciacli` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciacliid`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provinciadelcaso`;
CREATE TABLE `vtiger_provinciadelcaso` (
  `provinciadelcasoid` int(11) NOT NULL AUTO_INCREMENT,
  `provinciadelcaso` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciadelcasoid`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provinciadelcliente`;
CREATE TABLE `vtiger_provinciadelcliente` (
  `provinciadelclienteid` int(11) NOT NULL AUTO_INCREMENT,
  `provinciadelcliente` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciadelclienteid`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_provinciaempleador`;
CREATE TABLE `vtiger_provinciaempleador` (
  `provinciaempleadorid` int(11) NOT NULL AUTO_INCREMENT,
  `provinciaempleador` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`provinciaempleadorid`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_publicholiday`;
CREATE TABLE `vtiger_publicholiday` (
  `publicholidayid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id of public holiday',
  `holidaydate` date NOT NULL COMMENT 'date of holiday',
  `holidayname` varchar(255) NOT NULL COMMENT 'name of holiday',
  `holidaytype` varchar(25) DEFAULT NULL COMMENT 'type of holiday',
  PRIMARY KEY (`publicholidayid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_quiendenuncio`;
CREATE TABLE `vtiger_quiendenuncio` (
  `quiendenuncioid` int(11) NOT NULL AUTO_INCREMENT,
  `quiendenuncio` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`quiendenuncioid`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_quienenvioppto`;
CREATE TABLE `vtiger_quienenvioppto` (
  `quienenviopptoid` int(11) NOT NULL AUTO_INCREMENT,
  `quienenvioppto` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`quienenviopptoid`)
) ENGINE=InnoDB AUTO_INCREMENT=247 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rangohorpre`;
CREATE TABLE `vtiger_rangohorpre` (
  `rangohorpreid` int(11) NOT NULL AUTO_INCREMENT,
  `rangohorpre` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`rangohorpreid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_razongestionarprogreso`;
CREATE TABLE `vtiger_razongestionarprogreso` (
  `razongestionarprogresoid` int(11) NOT NULL AUTO_INCREMENT,
  `razongestionarprogreso` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`razongestionarprogresoid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_razonnoaplica`;
CREATE TABLE `vtiger_razonnoaplica` (
  `razonnoaplicaid` int(11) NOT NULL AUTO_INCREMENT,
  `razonnoaplica` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  `color` varchar(25) DEFAULT NULL,
  PRIMARY KEY (`razonnoaplicaid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_realization_process`;
CREATE TABLE `vtiger_realization_process` (
  `module_id` int(10) NOT NULL,
  `status_indicate_closing` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reconocimientodeuda_inventory`;
CREATE TABLE `vtiger_reconocimientodeuda_inventory` (
  `id` int(11) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  KEY `reconocimientodeuda_inventory_idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reconocimientodeuda_invfield`;
CREATE TABLE `vtiger_reconocimientodeuda_invfield` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` smallint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` smallint(1) unsigned NOT NULL,
  `displaytype` smallint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` smallint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reconocimientodeuda_invmap`;
CREATE TABLE `vtiger_reconocimientodeuda_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_recurring_frequency`;
CREATE TABLE `vtiger_recurring_frequency` (
  `recurring_frequency_id` int(10) DEFAULT NULL,
  `recurring_frequency` varchar(200) DEFAULT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_recurring_frequency_seq`;
CREATE TABLE `vtiger_recurring_frequency_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_region`;
CREATE TABLE `vtiger_region` (
  `regionid` int(11) NOT NULL AUTO_INCREMENT,
  `region` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regionid`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_regionbi1`;
CREATE TABLE `vtiger_regionbi1` (
  `regionbi1id` int(11) NOT NULL AUTO_INCREMENT,
  `regionbi1` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regionbi1id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_regionbi2`;
CREATE TABLE `vtiger_regionbi2` (
  `regionbi2id` int(11) NOT NULL AUTO_INCREMENT,
  `regionbi2` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regionbi2id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_regioncli`;
CREATE TABLE `vtiger_regioncli` (
  `regioncliid` int(11) NOT NULL AUTO_INCREMENT,
  `regioncli` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regioncliid`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_regiondelcaso`;
CREATE TABLE `vtiger_regiondelcaso` (
  `regiondelcasoid` int(11) NOT NULL AUTO_INCREMENT,
  `regiondelcaso` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regiondelcasoid`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_regiondelcliente`;
CREATE TABLE `vtiger_regiondelcliente` (
  `regiondelclienteid` int(11) NOT NULL AUTO_INCREMENT,
  `regiondelcliente` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regiondelclienteid`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_regionempleador`;
CREATE TABLE `vtiger_regionempleador` (
  `regionempleadorid` int(11) NOT NULL AUTO_INCREMENT,
  `regionempleador` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`regionempleadorid`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rel_mod`;
CREATE TABLE `vtiger_rel_mod` (
  `rel_modid` int(10) NOT NULL AUTO_INCREMENT,
  `rel_mod` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`rel_modid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rel_mod_seq`;
CREATE TABLE `vtiger_rel_mod_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_relatedlists`;
CREATE TABLE `vtiger_relatedlists` (
  `relation_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) unsigned NOT NULL,
  `related_tabid` smallint(5) unsigned NOT NULL,
  `name` varchar(50) DEFAULT NULL,
  `sequence` tinyint(3) unsigned NOT NULL,
  `label` varchar(50) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `actions` varchar(50) NOT NULL DEFAULT '',
  `favorites` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `creator_detail` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `relation_comment` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `view_type` varchar(100) NOT NULL DEFAULT 'RelatedTab',
  PRIMARY KEY (`relation_id`),
  KEY `tabid` (`tabid`),
  KEY `related_tabid` (`related_tabid`),
  KEY `tabid_2` (`tabid`,`related_tabid`),
  KEY `tabid_3` (`tabid`,`related_tabid`,`label`),
  KEY `tabid_4` (`tabid`,`related_tabid`,`presence`)
) ENGINE=InnoDB AUTO_INCREMENT=743 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_relatedlists_fields`;
CREATE TABLE `vtiger_relatedlists_fields` (
  `relation_id` int(10) DEFAULT NULL,
  `fieldid` int(10) DEFAULT NULL,
  `fieldname` varchar(30) DEFAULT NULL,
  `sequence` int(10) DEFAULT NULL,
  KEY `relation_id` (`relation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reminder_interval`;
CREATE TABLE `vtiger_reminder_interval` (
  `reminder_intervalid` int(10) NOT NULL AUTO_INCREMENT,
  `reminder_interval` varchar(200) NOT NULL,
  `sortorderid` int(10) NOT NULL,
  `presence` int(1) NOT NULL,
  PRIMARY KEY (`reminder_intervalid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reminder_interval_seq`;
CREATE TABLE `vtiger_reminder_interval_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportfilters`;
CREATE TABLE `vtiger_reportfilters` (
  `filterid` int(10) NOT NULL,
  `name` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportfolder`;
CREATE TABLE `vtiger_reportfolder` (
  `folderid` int(10) NOT NULL AUTO_INCREMENT,
  `foldername` varchar(100) NOT NULL DEFAULT '',
  `description` varchar(250) DEFAULT '',
  `state` varchar(50) DEFAULT 'SAVED',
  PRIMARY KEY (`folderid`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportsharing`;
CREATE TABLE `vtiger_reportsharing` (
  `reportid` int(10) NOT NULL,
  `shareid` int(10) NOT NULL,
  `setype` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reporttype`;
CREATE TABLE `vtiger_reporttype` (
  `reportid` int(10) NOT NULL,
  `data` text,
  PRIMARY KEY (`reportid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservations_inventory`;
CREATE TABLE `vtiger_reservations_inventory` (
  `id` int(11) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  KEY `reservations_inventory_idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservations_invfield`;
CREATE TABLE `vtiger_reservations_invfield` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` smallint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` smallint(1) unsigned NOT NULL,
  `displaytype` smallint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` smallint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservations_invmap`;
CREATE TABLE `vtiger_reservations_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservations_status`;
CREATE TABLE `vtiger_reservations_status` (
  `reservations_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `reservations_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`reservations_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservations_status_seq`;
CREATE TABLE `vtiger_reservations_status_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_resultadoaudiencia`;
CREATE TABLE `vtiger_resultadoaudiencia` (
  `resultadoaudienciaid` int(11) NOT NULL AUTO_INCREMENT,
  `resultadoaudiencia` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`resultadoaudienciaid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_resultgestion`;
CREATE TABLE `vtiger_resultgestion` (
  `resultgestionid` int(11) NOT NULL AUTO_INCREMENT,
  `resultgestion` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`resultgestionid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_retencionventas`;
CREATE TABLE `vtiger_retencionventas` (
  `retencionventasid` int(11) NOT NULL AUTO_INCREMENT,
  `retencionventas` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`retencionventasid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_role`;
CREATE TABLE `vtiger_role` (
  `roleid` varchar(255) NOT NULL,
  `rolename` varchar(200) DEFAULT NULL,
  `parentrole` varchar(255) DEFAULT NULL,
  `depth` smallint(5) unsigned NOT NULL DEFAULT '0',
  `allowassignedrecordsto` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `changeowner` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `searchunpriv` text,
  `clendarallorecords` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `listrelatedrecord` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `previewrelatedrecord` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `editrelatedrecord` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `permissionsrelatedfield` varchar(10) NOT NULL DEFAULT '0',
  `globalsearchadv` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `assignedmultiowner` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `auto_assign` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`roleid`),
  KEY `parentrole` (`parentrole`),
  KEY `parentrole_2` (`parentrole`,`depth`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_role_seq`;
CREATE TABLE `vtiger_role_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rowheight`;
CREATE TABLE `vtiger_rowheight` (
  `rowheightid` int(10) NOT NULL AUTO_INCREMENT,
  `rowheight` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`rowheightid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rowheight_seq`;
CREATE TABLE `vtiger_rowheight_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rss`;
CREATE TABLE `vtiger_rss` (
  `rssid` int(10) NOT NULL AUTO_INCREMENT,
  `rssurl` varchar(200) NOT NULL DEFAULT '',
  `rsstitle` varchar(200) DEFAULT NULL,
  `rsstype` int(10) DEFAULT '0',
  `starred` int(1) DEFAULT '0',
  PRIMARY KEY (`rssid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rutciaseguros`;
CREATE TABLE `vtiger_rutciaseguros` (
  `rutciasegurosid` int(11) NOT NULL AUTO_INCREMENT,
  `rutciaseguros` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`rutciasegurosid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_rutcomp`;
CREATE TABLE `vtiger_rutcomp` (
  `rutcompid` int(11) NOT NULL AUTO_INCREMENT,
  `rutcomp` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`rutcompid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_salutationtype`;
CREATE TABLE `vtiger_salutationtype` (
  `salutationtypeid` int(10) NOT NULL AUTO_INCREMENT,
  `salutationtype` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT NULL,
  PRIMARY KEY (`salutationtypeid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_salutationtype_seq`;
CREATE TABLE `vtiger_salutationtype_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_scalculations_status`;
CREATE TABLE `vtiger_scalculations_status` (
  `scalculations_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `scalculations_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`scalculations_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_seattachmentsrel`;
CREATE TABLE `vtiger_seattachmentsrel` (
  `crmid` int(10) NOT NULL DEFAULT '0',
  `attachmentsid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`crmid`,`attachmentsid`),
  KEY `seattachmentsrel_attachmentsid_idx` (`attachmentsid`),
  KEY `seattachmentsrel_crmid_idx` (`crmid`),
  KEY `seattachmentsrel_attachmentsid_crmid_idx` (`attachmentsid`,`crmid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_selectquery`;
CREATE TABLE `vtiger_selectquery` (
  `queryid` int(10) NOT NULL,
  `startindex` int(10) DEFAULT '0',
  `numofobjects` int(10) DEFAULT '0',
  PRIMARY KEY (`queryid`),
  KEY `selectquery_queryid_idx` (`queryid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_selectquery_seq`;
CREATE TABLE `vtiger_selectquery_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_service_usageunit`;
CREATE TABLE `vtiger_service_usageunit` (
  `service_usageunitid` int(10) NOT NULL AUTO_INCREMENT,
  `service_usageunit` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`service_usageunitid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_service_usageunit_seq`;
CREATE TABLE `vtiger_service_usageunit_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_settings_blocks`;
CREATE TABLE `vtiger_settings_blocks` (
  `blockid` int(10) NOT NULL,
  `label` varchar(250) DEFAULT NULL,
  `sequence` int(10) DEFAULT NULL,
  `icon` varchar(255) DEFAULT NULL,
  `type` tinyint(1) DEFAULT NULL,
  `linkto` text,
  `admin_access` text,
  PRIMARY KEY (`blockid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_settings_blocks_seq`;
CREATE TABLE `vtiger_settings_blocks_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_sharedcalendar`;
CREATE TABLE `vtiger_sharedcalendar` (
  `userid` int(10) NOT NULL,
  `sharedid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`sharedid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_shorturls`;
CREATE TABLE `vtiger_shorturls` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `uid` varchar(50) DEFAULT NULL,
  `handler_path` varchar(400) DEFAULT NULL,
  `handler_class` varchar(100) DEFAULT NULL,
  `handler_function` varchar(100) DEFAULT NULL,
  `handler_data` varchar(255) DEFAULT NULL,
  `onetime` int(5) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_siniestro_inventory`;
CREATE TABLE `vtiger_siniestro_inventory` (
  `id` int(11) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  KEY `siniestro_inventory_idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_siniestro_invfield`;
CREATE TABLE `vtiger_siniestro_invfield` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` smallint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` smallint(1) unsigned NOT NULL,
  `displaytype` smallint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` smallint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_siniestro_invmap`;
CREATE TABLE `vtiger_siniestro_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_smsnotifier_status`;
CREATE TABLE `vtiger_smsnotifier_status` (
  `smsnotifier_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `smsnotifier_status` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(5) DEFAULT '0',
  PRIMARY KEY (`smsnotifier_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_soapservice`;
CREATE TABLE `vtiger_soapservice` (
  `id` int(10) DEFAULT NULL,
  `type` varchar(25) DEFAULT NULL,
  `sessionid` varchar(100) DEFAULT NULL,
  `lang` varchar(10) DEFAULT NULL,
  KEY `id` (`id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_solcontact`;
CREATE TABLE `vtiger_solcontact` (
  `solcontactid` int(11) NOT NULL AUTO_INCREMENT,
  `solcontact` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`solcontactid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_solparagestionarprogreso`;
CREATE TABLE `vtiger_solparagestionarprogreso` (
  `solparagestionarprogresoid` int(11) NOT NULL AUTO_INCREMENT,
  `solparagestionarprogreso` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`solparagestionarprogresoid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_squoteenquiries_status`;
CREATE TABLE `vtiger_squoteenquiries_status` (
  `squoteenquiries_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `squoteenquiries_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`squoteenquiries_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_squotes_status`;
CREATE TABLE `vtiger_squotes_status` (
  `squotes_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `squotes_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`squotes_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_srecurringorders_status`;
CREATE TABLE `vtiger_srecurringorders_status` (
  `srecurringorders_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `srecurringorders_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`srecurringorders_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_srequirementscards_status`;
CREATE TABLE `vtiger_srequirementscards_status` (
  `srequirementscards_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `srequirementscards_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`srequirementscards_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssalesprocesses_source`;
CREATE TABLE `vtiger_ssalesprocesses_source` (
  `ssalesprocesses_sourceid` int(10) NOT NULL AUTO_INCREMENT,
  `ssalesprocesses_source` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`ssalesprocesses_sourceid`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssalesprocesses_status`;
CREATE TABLE `vtiger_ssalesprocesses_status` (
  `ssalesprocesses_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `ssalesprocesses_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ssalesprocesses_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssalesprocesses_type`;
CREATE TABLE `vtiger_ssalesprocesses_type` (
  `ssalesprocesses_typeid` int(10) NOT NULL AUTO_INCREMENT,
  `ssalesprocesses_type` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`ssalesprocesses_typeid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssingleorders_source`;
CREATE TABLE `vtiger_ssingleorders_source` (
  `ssingleorders_sourceid` int(10) NOT NULL AUTO_INCREMENT,
  `ssingleorders_source` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`ssingleorders_sourceid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssingleorders_status`;
CREATE TABLE `vtiger_ssingleorders_status` (
  `ssingleorders_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `ssingleorders_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ssingleorders_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssservicesstatus`;
CREATE TABLE `vtiger_ssservicesstatus` (
  `ssservicesstatusid` int(10) NOT NULL AUTO_INCREMENT,
  `ssservicesstatus` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`ssservicesstatusid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ssservicesstatus_seq`;
CREATE TABLE `vtiger_ssservicesstatus_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_start_hour`;
CREATE TABLE `vtiger_start_hour` (
  `start_hourid` int(10) NOT NULL AUTO_INCREMENT,
  `start_hour` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`start_hourid`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_start_hour_seq`;
CREATE TABLE `vtiger_start_hour_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_state`;
CREATE TABLE `vtiger_state` (
  `stateid` int(10) NOT NULL AUTO_INCREMENT,
  `state` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`stateid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_state_seq`;
CREATE TABLE `vtiger_state_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_status`;
CREATE TABLE `vtiger_status` (
  `statusid` int(10) NOT NULL AUTO_INCREMENT,
  `status` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_status_seq`;
CREATE TABLE `vtiger_status_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_storage_status`;
CREATE TABLE `vtiger_storage_status` (
  `storage_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `storage_status` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`storage_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_storage_type`;
CREATE TABLE `vtiger_storage_type` (
  `storage_typeid` int(10) NOT NULL AUTO_INCREMENT,
  `storage_type` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`storage_typeid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subidadocs_inventory`;
CREATE TABLE `vtiger_subidadocs_inventory` (
  `id` int(11) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  KEY `subidadocs_inventory_idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subidadocs_invfield`;
CREATE TABLE `vtiger_subidadocs_invfield` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` smallint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` smallint(1) unsigned NOT NULL,
  `displaytype` smallint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` smallint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subidadocs_invmap`;
CREATE TABLE `vtiger_subidadocs_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subindustry`;
CREATE TABLE `vtiger_subindustry` (
  `subindustryid` int(10) NOT NULL AUTO_INCREMENT,
  `subindustry` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`subindustryid`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subindustry_seq`;
CREATE TABLE `vtiger_subindustry_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subunit`;
CREATE TABLE `vtiger_subunit` (
  `subunitid` int(10) NOT NULL AUTO_INCREMENT,
  `subunit` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`subunitid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_support_processes`;
CREATE TABLE `vtiger_support_processes` (
  `id` int(10) NOT NULL,
  `ticket_status_indicate_closing` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripcion_inventory`;
CREATE TABLE `vtiger_suscripcion_inventory` (
  `id` int(11) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  KEY `suscripcion_inventory_idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripcion_invfield`;
CREATE TABLE `vtiger_suscripcion_invfield` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` smallint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` smallint(1) unsigned NOT NULL,
  `displaytype` smallint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` smallint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripcion_invmap`;
CREATE TABLE `vtiger_suscripcion_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_svendorenquiries_status`;
CREATE TABLE `vtiger_svendorenquiries_status` (
  `svendorenquiries_statusid` int(10) NOT NULL AUTO_INCREMENT,
  `svendorenquiries_status` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `picklist_valueid` smallint(5) DEFAULT '0',
  `sortorderid` smallint(5) DEFAULT '0',
  PRIMARY KEY (`svendorenquiries_statusid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_systems`;
CREATE TABLE `vtiger_systems` (
  `id` int(10) NOT NULL,
  `server` varchar(100) DEFAULT NULL,
  `server_port` int(10) DEFAULT NULL,
  `server_username` varchar(100) DEFAULT NULL,
  `server_password` varchar(100) DEFAULT NULL,
  `server_type` varchar(20) DEFAULT NULL,
  `smtp_auth` varchar(5) DEFAULT NULL,
  `server_path` varchar(256) DEFAULT NULL,
  `from_email_field` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tab`;
CREATE TABLE `vtiger_tab` (
  `tabid` smallint(5) NOT NULL DEFAULT '0',
  `name` varchar(25) NOT NULL,
  `presence` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `tabsequence` smallint(5) NOT NULL DEFAULT '0',
  `tablabel` varchar(25) NOT NULL,
  `modifiedby` smallint(5) DEFAULT NULL,
  `modifiedtime` int(10) DEFAULT NULL,
  `customized` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `ownedby` tinyint(1) NOT NULL DEFAULT '0',
  `isentitytype` tinyint(1) NOT NULL DEFAULT '1',
  `version` varchar(10) DEFAULT NULL,
  `parent` varchar(30) DEFAULT NULL,
  `color` varchar(30) DEFAULT NULL,
  `coloractive` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`tabid`),
  UNIQUE KEY `tab_name_idx` (`name`),
  KEY `tab_modifiedby_idx` (`modifiedby`),
  KEY `tab_tabid_idx` (`tabid`),
  KEY `name` (`name`,`presence`),
  KEY `presence` (`presence`),
  KEY `name_2` (`name`,`presence`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpago`;
CREATE TABLE `vtiger_tarjpago` (
  `tarjpagoid` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpago` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagoid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagoabono`;
CREATE TABLE `vtiger_tarjpagoabono` (
  `tarjpagoabonoid` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagoabono` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagoabonoid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagocuota1`;
CREATE TABLE `vtiger_tarjpagocuota1` (
  `tarjpagocuota1id` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagocuota1` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagocuota1id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagocuota2`;
CREATE TABLE `vtiger_tarjpagocuota2` (
  `tarjpagocuota2id` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagocuota2` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagocuota2id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagocuota3`;
CREATE TABLE `vtiger_tarjpagocuota3` (
  `tarjpagocuota3id` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagocuota3` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagocuota3id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagocuota4`;
CREATE TABLE `vtiger_tarjpagocuota4` (
  `tarjpagocuota4id` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagocuota4` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagocuota4id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagocuota5`;
CREATE TABLE `vtiger_tarjpagocuota5` (
  `tarjpagocuota5id` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagocuota5` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagocuota5id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tarjpagocuota6`;
CREATE TABLE `vtiger_tarjpagocuota6` (
  `tarjpagocuota6id` int(11) NOT NULL AUTO_INCREMENT,
  `tarjpagocuota6` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tarjpagocuota6id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_taskpriority`;
CREATE TABLE `vtiger_taskpriority` (
  `taskpriorityid` int(10) NOT NULL AUTO_INCREMENT,
  `taskpriority` varchar(200) DEFAULT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT NULL,
  PRIMARY KEY (`taskpriorityid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_taskpriority_seq`;
CREATE TABLE `vtiger_taskpriority_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketpriorities`;
CREATE TABLE `vtiger_ticketpriorities` (
  `ticketpriorities_id` int(10) NOT NULL AUTO_INCREMENT,
  `ticketpriorities` varchar(200) DEFAULT NULL,
  `presence` int(1) NOT NULL DEFAULT '0',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT NULL,
  `color` varchar(25) DEFAULT '	#E6FAD8',
  PRIMARY KEY (`ticketpriorities_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketpriorities_seq`;
CREATE TABLE `vtiger_ticketpriorities_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketseverities`;
CREATE TABLE `vtiger_ticketseverities` (
  `ticketseverities_id` int(10) NOT NULL AUTO_INCREMENT,
  `ticketseverities` varchar(200) DEFAULT NULL,
  `presence` int(1) NOT NULL DEFAULT '0',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT NULL,
  PRIMARY KEY (`ticketseverities_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketseverities_seq`;
CREATE TABLE `vtiger_ticketseverities_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketstatus`;
CREATE TABLE `vtiger_ticketstatus` (
  `ticketstatus_id` int(10) NOT NULL AUTO_INCREMENT,
  `ticketstatus` varchar(200) DEFAULT NULL,
  `presence` int(1) NOT NULL DEFAULT '0',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT NULL,
  `color` varchar(25) DEFAULT '#E6FAD8',
  PRIMARY KEY (`ticketstatus_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketstatus_seq`;
CREATE TABLE `vtiger_ticketstatus_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_time_zone`;
CREATE TABLE `vtiger_time_zone` (
  `time_zoneid` int(10) NOT NULL AUTO_INCREMENT,
  `time_zone` varchar(200) NOT NULL,
  `sortorderid` int(10) NOT NULL DEFAULT '0',
  `presence` int(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`time_zoneid`)
) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_time_zone_seq`;
CREATE TABLE `vtiger_time_zone_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_timecontrol_type`;
CREATE TABLE `vtiger_timecontrol_type` (
  `timecontrol_typeid` int(10) NOT NULL AUTO_INCREMENT,
  `timecontrol_type` varchar(200) NOT NULL,
  `sortorderid` int(10) DEFAULT NULL,
  `presence` int(10) NOT NULL DEFAULT '1',
  `color` varchar(25) DEFAULT '#E6FAD8',
  PRIMARY KEY (`timecontrol_typeid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_timecontrol_type_seq`;
CREATE TABLE `vtiger_timecontrol_type_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tip_rec`;
CREATE TABLE `vtiger_tip_rec` (
  `tip_recid` int(11) NOT NULL AUTO_INCREMENT,
  `tip_rec` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tip_recid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipddacob`;
CREATE TABLE `vtiger_tipddacob` (
  `tipddacobid` int(11) NOT NULL AUTO_INCREMENT,
  `tipddacob` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipddacobid`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipo_demanda`;
CREATE TABLE `vtiger_tipo_demanda` (
  `tipo_demandaid` int(11) NOT NULL AUTO_INCREMENT,
  `tipo_demanda` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipo_demandaid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipocliente`;
CREATE TABLE `vtiger_tipocliente` (
  `tipoclienteid` int(11) NOT NULL AUTO_INCREMENT,
  `tipocliente` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipoclienteid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipocobranza`;
CREATE TABLE `vtiger_tipocobranza` (
  `tipocobranzaid` int(11) NOT NULL AUTO_INCREMENT,
  `tipocobranza` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipocobranzaid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipocontrato`;
CREATE TABLE `vtiger_tipocontrato` (
  `tipocontratoid` int(11) NOT NULL AUTO_INCREMENT,
  `tipocontrato` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipocontratoid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipocuenta`;
CREATE TABLE `vtiger_tipocuenta` (
  `tipocuentaid` int(11) NOT NULL AUTO_INCREMENT,
  `tipocuenta` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipocuentaid`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipoddacobranza`;
CREATE TABLE `vtiger_tipoddacobranza` (
  `tipoddacobranzaid` int(11) NOT NULL AUTO_INCREMENT,
  `tipoddacobranza` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipoddacobranzaid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipodenegociacion`;
CREATE TABLE `vtiger_tipodenegociacion` (
  `tipodenegociacionid` int(11) NOT NULL AUTO_INCREMENT,
  `tipodenegociacion` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipodenegociacionid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipodepagocuotados`;
CREATE TABLE `vtiger_tipodepagocuotados` (
  `tipodepagocuotadosid` int(11) NOT NULL AUTO_INCREMENT,
  `tipodepagocuotados` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipodepagocuotadosid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipodepagocuotatres`;
CREATE TABLE `vtiger_tipodepagocuotatres` (
  `tipodepagocuotatresid` int(11) NOT NULL AUTO_INCREMENT,
  `tipodepagocuotatres` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipodepagocuotatresid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipodepagocuotauno`;
CREATE TABLE `vtiger_tipodepagocuotauno` (
  `tipodepagocuotaunoid` int(11) NOT NULL AUTO_INCREMENT,
  `tipodepagocuotauno` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipodepagocuotaunoid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipoempleado`;
CREATE TABLE `vtiger_tipoempleado` (
  `tipoempleadoid` int(11) NOT NULL AUTO_INCREMENT,
  `tipoempleado` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipoempleadoid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipoempleadoconyugue`;
CREATE TABLE `vtiger_tipoempleadoconyugue` (
  `tipoempleadoconyugueid` int(11) NOT NULL AUTO_INCREMENT,
  `tipoempleadoconyugue` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipoempleadoconyugueid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipoinspeccion`;
CREATE TABLE `vtiger_tipoinspeccion` (
  `tipoinspeccionid` int(11) NOT NULL AUTO_INCREMENT,
  `tipoinspeccion` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipoinspeccionid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipopago`;
CREATE TABLE `vtiger_tipopago` (
  `tipopagoid` int(11) NOT NULL AUTO_INCREMENT,
  `tipopago` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipopagoid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipopagoaddendum1`;
CREATE TABLE `vtiger_tipopagoaddendum1` (
  `tipopagoaddendum1id` int(11) NOT NULL AUTO_INCREMENT,
  `tipopagoaddendum1` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipopagoaddendum1id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipoplan`;
CREATE TABLE `vtiger_tipoplan` (
  `tipoplanid` int(11) NOT NULL AUTO_INCREMENT,
  `tipoplan` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipoplanid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tipopropiedad`;
CREATE TABLE `vtiger_tipopropiedad` (
  `tipopropiedadid` int(11) NOT NULL AUTO_INCREMENT,
  `tipopropiedad` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tipopropiedadid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tiposervicio`;
CREATE TABLE `vtiger_tiposervicio` (
  `tiposervicioid` int(11) NOT NULL AUTO_INCREMENT,
  `tiposervicio` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tiposervicioid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tiposiniestro`;
CREATE TABLE `vtiger_tiposiniestro` (
  `tiposiniestroid` int(11) NOT NULL AUTO_INCREMENT,
  `tiposiniestro` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tiposiniestroid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tlfcontacto`;
CREATE TABLE `vtiger_tlfcontacto` (
  `tlfcontactoid` int(11) NOT NULL AUTO_INCREMENT,
  `tlfcontacto` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tlfcontactoid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpago1cuota`;
CREATE TABLE `vtiger_tpago1cuota` (
  `tpago1cuotaid` int(11) NOT NULL AUTO_INCREMENT,
  `tpago1cuota` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpago1cuotaid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpago2cuota`;
CREATE TABLE `vtiger_tpago2cuota` (
  `tpago2cuotaid` int(11) NOT NULL AUTO_INCREMENT,
  `tpago2cuota` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpago2cuotaid`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpago3cuota`;
CREATE TABLE `vtiger_tpago3cuota` (
  `tpago3cuotaid` int(11) NOT NULL AUTO_INCREMENT,
  `tpago3cuota` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpago3cuotaid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpago4cuota`;
CREATE TABLE `vtiger_tpago4cuota` (
  `tpago4cuotaid` int(11) NOT NULL AUTO_INCREMENT,
  `tpago4cuota` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpago4cuotaid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpago5cuota`;
CREATE TABLE `vtiger_tpago5cuota` (
  `tpago5cuotaid` int(11) NOT NULL AUTO_INCREMENT,
  `tpago5cuota` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpago5cuotaid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpago6cuota`;
CREATE TABLE `vtiger_tpago6cuota` (
  `tpago6cuotaid` int(11) NOT NULL AUTO_INCREMENT,
  `tpago6cuota` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpago6cuotaid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tpagoabono`;
CREATE TABLE `vtiger_tpagoabono` (
  `tpagoabonoid` int(11) NOT NULL AUTO_INCREMENT,
  `tpagoabono` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tpagoabonoid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tracking_unit`;
CREATE TABLE `vtiger_tracking_unit` (
  `tracking_unitid` int(10) NOT NULL AUTO_INCREMENT,
  `tracking_unit` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`tracking_unitid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tracking_unit_seq`;
CREATE TABLE `vtiger_tracking_unit_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_trees_templates`;
CREATE TABLE `vtiger_trees_templates` (
  `templateid` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `module` int(10) DEFAULT NULL,
  `access` int(1) DEFAULT '1',
  `share` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`templateid`),
  KEY `module` (`module`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_trees_templates_data`;
CREATE TABLE `vtiger_trees_templates_data` (
  `templateid` smallint(5) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `tree` varchar(255) NOT NULL,
  `parenttrre` varchar(255) NOT NULL,
  `depth` tinyint(3) unsigned NOT NULL,
  `label` varchar(255) NOT NULL,
  `state` varchar(100) NOT NULL DEFAULT '',
  `icon` varchar(255) NOT NULL DEFAULT '',
  KEY `id` (`templateid`),
  KEY `parenttrre` (`parenttrre`,`templateid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tribunal`;
CREATE TABLE `vtiger_tribunal` (
  `tribunalid` int(11) NOT NULL AUTO_INCREMENT,
  `tribunal` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tribunalid`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tribunalcompetente`;
CREATE TABLE `vtiger_tribunalcompetente` (
  `tribunalcompetenteid` int(11) NOT NULL AUTO_INCREMENT,
  `tribunalcompetente` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tribunalcompetenteid`)
) ENGINE=InnoDB AUTO_INCREMENT=139 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tribunalcompetentedc`;
CREATE TABLE `vtiger_tribunalcompetentedc` (
  `tribunalcompetentedcid` int(11) NOT NULL AUTO_INCREMENT,
  `tribunalcompetentedc` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tribunalcompetentedcid`)
) ENGINE=InnoDB AUTO_INCREMENT=139 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tribunalradicado`;
CREATE TABLE `vtiger_tribunalradicado` (
  `tribunalradicadoid` int(11) NOT NULL AUTO_INCREMENT,
  `tribunalradicado` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tribunalradicadoid`)
) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tribunalradicadodc`;
CREATE TABLE `vtiger_tribunalradicadodc` (
  `tribunalradicadodcid` int(11) NOT NULL AUTO_INCREMENT,
  `tribunalradicadodc` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`tribunalradicadodcid`)
) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_usageunit`;
CREATE TABLE `vtiger_usageunit` (
  `usageunitid` int(10) NOT NULL AUTO_INCREMENT,
  `usageunit` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT NULL,
  PRIMARY KEY (`usageunitid`),
  UNIQUE KEY `usageunit_usageunit_idx` (`usageunit`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_usageunit_seq`;
CREATE TABLE `vtiger_usageunit_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_user2mergefields`;
CREATE TABLE `vtiger_user2mergefields` (
  `userid` int(10) DEFAULT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `fieldid` int(10) DEFAULT NULL,
  `visible` int(2) DEFAULT NULL,
  KEY `userid_tabid_idx` (`userid`,`tabid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_users`;
CREATE TABLE `vtiger_users` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(32) DEFAULT NULL,
  `first_name` varchar(30) DEFAULT NULL,
  `last_name` varchar(30) DEFAULT NULL,
  `email1` varchar(100) DEFAULT NULL,
  `is_admin` varchar(3) DEFAULT '0',
  `status` varchar(25) DEFAULT NULL,
  `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `language` varchar(36) DEFAULT NULL,
  `user_password` varchar(200) DEFAULT NULL,
  `internal_mailer` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `reports_to_id` mediumint(10) unsigned DEFAULT NULL,
  `modified_user_id` varchar(36) DEFAULT NULL,
  `currency_id` mediumint(10) NOT NULL DEFAULT '1',
  `description` text,
  `date_entered` timestamp NULL DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT NULL,
  `date_password_change` datetime DEFAULT NULL,
  `force_password_change` tinyint(1) DEFAULT '0',
  `holidays` varchar(60) DEFAULT NULL,
  `namedays` varchar(60) DEFAULT NULL,
  `workdays` varchar(30) DEFAULT NULL,
  `weekstart` int(10) DEFAULT NULL,
  `date_format` varchar(200) DEFAULT NULL,
  `hour_format` varchar(30) DEFAULT 'am/pm',
  `start_hour` varchar(30) DEFAULT '10:00',
  `end_hour` varchar(30) DEFAULT '23:00',
  `view_date_format` varchar(50) DEFAULT 'PLL_ELAPSED',
  `activity_view` varchar(200) DEFAULT 'Today',
  `lead_view` varchar(200) DEFAULT 'Today',
  `imagename` varchar(250) DEFAULT NULL,
  `reminder_interval` varchar(100) DEFAULT NULL,
  `reminder_next_time` varchar(100) DEFAULT NULL,
  `theme` varchar(100) DEFAULT NULL,
  `tz` varchar(30) DEFAULT NULL,
  `time_zone` varchar(200) DEFAULT NULL,
  `currency_grouping_pattern` varchar(100) DEFAULT NULL,
  `currency_decimal_separator` varchar(2) DEFAULT NULL,
  `currency_grouping_separator` varchar(2) DEFAULT NULL,
  `currency_symbol_placement` varchar(20) DEFAULT NULL,
  `no_of_currency_decimals` tinyint(1) unsigned DEFAULT NULL,
  `truncate_trailing_zeros` tinyint(1) unsigned DEFAULT NULL,
  `dayoftheweek` varchar(100) DEFAULT NULL,
  `callduration` smallint(3) unsigned DEFAULT NULL,
  `othereventduration` smallint(3) unsigned DEFAULT NULL,
  `default_record_view` varchar(10) DEFAULT NULL,
  `leftpanelhide` tinyint(3) unsigned DEFAULT NULL,
  `rowheight` varchar(10) DEFAULT NULL,
  `defaulteventstatus` varchar(50) DEFAULT NULL,
  `defaultactivitytype` varchar(50) DEFAULT NULL,
  `is_owner` varchar(5) DEFAULT NULL,
  `emailoptout` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `available` tinyint(1) DEFAULT '0',
  `auto_assign` tinyint(1) DEFAULT '0',
  `records_limit` int(10) DEFAULT NULL,
  `phone_crm_extension` varchar(100) DEFAULT NULL,
  `phone_crm_extension_extra` varchar(100) DEFAULT NULL,
  `accesskey` varchar(36) DEFAULT NULL,
  `confirm_password` varchar(200) DEFAULT NULL,
  `cal_color` varchar(25) DEFAULT NULL,
  `user_preferences` text,
  `phone` varchar(45) DEFAULT '',
  `sisfirma` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `email1` (`email1`),
  KEY `user_user_name_idx` (`user_name`),
  KEY `user_user_password_idx` (`user_password`),
  KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=403 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_users_last_import`;
CREATE TABLE `vtiger_users_last_import` (
  `id` int(36) NOT NULL AUTO_INCREMENT,
  `assigned_user_id` varchar(36) DEFAULT NULL,
  `bean_type` varchar(36) DEFAULT NULL,
  `bean_id` int(10) DEFAULT NULL,
  `deleted` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`assigned_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_users_seq`;
CREATE TABLE `vtiger_users_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_valorpie`;
CREATE TABLE `vtiger_valorpie` (
  `valorpieid` int(11) NOT NULL AUTO_INCREMENT,
  `valorpie` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`valorpieid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_valorplan`;
CREATE TABLE `vtiger_valorplan` (
  `valorplanid` int(11) NOT NULL AUTO_INCREMENT,
  `valorplan` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`valorplanid`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_verification`;
CREATE TABLE `vtiger_verification` (
  `verificationid` int(10) NOT NULL AUTO_INCREMENT,
  `verification` varchar(200) NOT NULL,
  `presence` int(1) NOT NULL DEFAULT '1',
  `picklist_valueid` int(10) NOT NULL DEFAULT '0',
  `sortorderid` int(10) DEFAULT '0',
  PRIMARY KEY (`verificationid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_verification_seq`;
CREATE TABLE `vtiger_verification_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_version`;
CREATE TABLE `vtiger_version` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `old_version` varchar(30) DEFAULT NULL,
  `current_version` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_version_seq`;
CREATE TABLE `vtiger_version_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_view_date_format`;
CREATE TABLE `vtiger_view_date_format` (
  `view_date_formatid` int(11) NOT NULL AUTO_INCREMENT,
  `view_date_format` varchar(50) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`view_date_formatid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_visibility`;
CREATE TABLE `vtiger_visibility` (
  `visibilityid` int(10) NOT NULL AUTO_INCREMENT,
  `visibility` varchar(200) NOT NULL,
  `sortorderid` int(10) NOT NULL DEFAULT '0',
  `presence` int(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`visibilityid`),
  UNIQUE KEY `visibility_visibility_idx` (`visibility`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_visibility_seq`;
CREATE TABLE `vtiger_visibility_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_viveencasa`;
CREATE TABLE `vtiger_viveencasa` (
  `viveencasaid` int(11) NOT NULL AUTO_INCREMENT,
  `viveencasa` varchar(255) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `sortorderid` smallint(6) DEFAULT '0',
  PRIMARY KEY (`viveencasaid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_entity`;
CREATE TABLE `vtiger_ws_entity` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(25) NOT NULL,
  `handler_path` varchar(255) NOT NULL,
  `handler_class` varchar(64) NOT NULL,
  `ismodule` int(3) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_entity_seq`;
CREATE TABLE `vtiger_ws_entity_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_fieldinfo`;
CREATE TABLE `vtiger_ws_fieldinfo` (
  `id` varchar(64) NOT NULL,
  `property_name` varchar(32) DEFAULT NULL,
  `property_value` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_fieldtype`;
CREATE TABLE `vtiger_ws_fieldtype` (
  `fieldtypeid` int(10) NOT NULL AUTO_INCREMENT,
  `uitype` smallint(3) NOT NULL,
  `fieldtype` varchar(200) NOT NULL,
  PRIMARY KEY (`fieldtypeid`),
  UNIQUE KEY `uitype_idx` (`uitype`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_operation`;
CREATE TABLE `vtiger_ws_operation` (
  `operationid` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL,
  `handler_path` varchar(255) NOT NULL,
  `handler_method` varchar(64) NOT NULL,
  `type` varchar(8) NOT NULL,
  `prelogin` int(3) NOT NULL,
  PRIMARY KEY (`operationid`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_operation_parameters`;
CREATE TABLE `vtiger_ws_operation_parameters` (
  `operationid` int(10) NOT NULL,
  `name` varchar(128) NOT NULL,
  `type` varchar(64) NOT NULL,
  `sequence` int(10) NOT NULL,
  PRIMARY KEY (`operationid`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_operation_seq`;
CREATE TABLE `vtiger_ws_operation_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_userauthtoken`;
CREATE TABLE `vtiger_ws_userauthtoken` (
  `userid` int(10) NOT NULL,
  `token` varchar(36) NOT NULL,
  `expiretime` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`expiretime`),
  UNIQUE KEY `userid_idx` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `w_yf_portal_session`;
CREATE TABLE `w_yf_portal_session` (
  `id` varchar(32) NOT NULL,
  `user_id` int(10) DEFAULT NULL,
  `language` varchar(10) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `changed` datetime DEFAULT NULL,
  `params` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `w_yf_portal_user`;
CREATE TABLE `w_yf_portal_user` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `server_id` int(10) DEFAULT NULL,
  `status` tinyint(1) DEFAULT '0',
  `user_name` varchar(50) NOT NULL,
  `password_h` varchar(200) DEFAULT NULL,
  `password_t` varchar(200) DEFAULT NULL,
  `type` tinyint(1) unsigned DEFAULT '1',
  `login_time` datetime DEFAULT NULL,
  `logout_time` datetime DEFAULT NULL,
  `language` varchar(10) DEFAULT NULL,
  `crmid` int(10) DEFAULT NULL,
  `user_id` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_name` (`user_name`),
  KEY `user_name_2` (`user_name`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `w_yf_servers`;
CREATE TABLE `w_yf_servers` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `pass` varchar(100) DEFAULT NULL,
  `acceptable_url` varchar(255) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `api_key` varchar(100) NOT NULL,
  `type` varchar(40) NOT NULL,
  `accounts_id` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_auth`;
CREATE TABLE `yetiforce_auth` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(20) DEFAULT NULL,
  `param` varchar(20) DEFAULT NULL,
  `value` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `type` (`type`,`param`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_currencyupdate_banks`;
CREATE TABLE `yetiforce_currencyupdate_banks` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `bank_name` varchar(255) NOT NULL,
  `active` int(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_bankname` (`bank_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_mail_config`;
CREATE TABLE `yetiforce_mail_config` (
  `type` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `value` text,
  UNIQUE KEY `type` (`type`,`name`),
  KEY `type_2` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_proc_marketing`;
CREATE TABLE `yetiforce_proc_marketing` (
  `type` varchar(30) DEFAULT NULL,
  `param` varchar(30) DEFAULT NULL,
  `value` varchar(200) DEFAULT NULL,
  KEY `type` (`type`,`param`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_proc_sales`;
CREATE TABLE `yetiforce_proc_sales` (
  `type` varchar(30) DEFAULT NULL,
  `param` varchar(30) DEFAULT NULL,
  `value` varchar(200) DEFAULT NULL,
  KEY `type` (`type`,`param`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_proc_tc`;
CREATE TABLE `yetiforce_proc_tc` (
  `type` varchar(30) DEFAULT NULL,
  `param` varchar(30) DEFAULT NULL,
  `value` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_updates`;
CREATE TABLE `yetiforce_updates` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `time` timestamp NULL DEFAULT NULL,
  `user` varchar(50) DEFAULT NULL,
  `name` varchar(100) DEFAULT NULL,
  `from_version` varchar(10) DEFAULT NULL,
  `to_version` varchar(10) DEFAULT NULL,
  `result` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `a_yf_mapped_fields`;
CREATE TABLE `a_yf_mapped_fields` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `mappedid` int(10) DEFAULT NULL,
  `type` varchar(30) DEFAULT NULL,
  `source` varchar(30) DEFAULT NULL,
  `target` varchar(30) DEFAULT NULL,
  `default` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `a_yf_mapped_fields_ibfk_1` (`mappedid`),
  CONSTRAINT `a_yf_mapped_fields_ibfk_1` FOREIGN KEY (`mappedid`) REFERENCES `a_yf_mapped_config` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=158 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `com_vtiger_workflowtasks`;
CREATE TABLE `com_vtiger_workflowtasks` (
  `task_id` int(10) NOT NULL AUTO_INCREMENT,
  `workflow_id` int(10) DEFAULT NULL,
  `summary` varchar(400) NOT NULL,
  `task` text,
  PRIMARY KEY (`task_id`),
  KEY `workflow_id` (`workflow_id`),
  CONSTRAINT `com_vtiger_workflowtasks_ibfk_1` FOREIGN KEY (`workflow_id`) REFERENCES `com_vtiger_workflows` (`workflow_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=471 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `dav_calendarobjects`;
CREATE TABLE `dav_calendarobjects` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `calendardata` mediumblob,
  `uri` varbinary(200) DEFAULT NULL,
  `calendarid` int(10) unsigned NOT NULL,
  `lastmodified` int(10) unsigned DEFAULT NULL,
  `etag` varbinary(32) DEFAULT NULL,
  `size` int(10) unsigned NOT NULL,
  `componenttype` varbinary(8) DEFAULT NULL,
  `firstoccurence` int(10) unsigned DEFAULT NULL,
  `lastoccurence` int(10) unsigned DEFAULT NULL,
  `uid` varbinary(200) DEFAULT NULL,
  `crmid` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `calendarid` (`calendarid`,`uri`),
  CONSTRAINT `dav_calendarobjects_ibfk_1` FOREIGN KEY (`calendarid`) REFERENCES `dav_calendars` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;;

DROP TABLE IF EXISTS `dav_addressbooks`;
CREATE TABLE `dav_addressbooks` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `principaluri` varbinary(255) DEFAULT NULL,
  `displayname` varchar(255) DEFAULT NULL,
  `uri` varbinary(200) DEFAULT NULL,
  `description` text,
  `synctoken` int(10) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `principaluri` (`principaluri`(100),`uri`(100)),
  KEY `dav_addressbooks_idx` (`principaluri`),
  CONSTRAINT `dav_addressbooks_ibfk_1` FOREIGN KEY (`principaluri`) REFERENCES `dav_principals` (`uri`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;;

DROP TABLE IF EXISTS `roundcube_cache`;
CREATE TABLE `roundcube_cache` (
  `user_id` int(10) unsigned NOT NULL,
  `cache_key` varchar(128) CHARACTER SET ascii NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  KEY `expires_index` (`expires`),
  KEY `user_cache_index` (`user_id`,`cache_key`),
  CONSTRAINT `roundcube_user_id_fk_cache` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_cache_index`;
CREATE TABLE `roundcube_cache_index` (
  `user_id` int(10) unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `valid` tinyint(1) NOT NULL DEFAULT '0',
  `data` longtext NOT NULL,
  PRIMARY KEY (`user_id`,`mailbox`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `roundcube_user_id_fk_cache_index` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_cache_messages`;
CREATE TABLE `roundcube_cache_messages` (
  `user_id` int(10) unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `uid` int(10) unsigned NOT NULL DEFAULT '0',
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  `flags` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`,`mailbox`,`uid`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `roundcube_user_id_fk_cache_messages` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_cache_thread`;
CREATE TABLE `roundcube_cache_thread` (
  `user_id` int(10) unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  PRIMARY KEY (`user_id`,`mailbox`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `roundcube_user_id_fk_cache_thread` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_contactgroups`;
CREATE TABLE `roundcube_contactgroups` (
  `contactgroup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL DEFAULT '',
  PRIMARY KEY (`contactgroup_id`),
  KEY `roundcube_contactgroups_user_index` (`user_id`,`del`),
  CONSTRAINT `roundcube_user_id_fk_contactgroups` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_contacts`;
CREATE TABLE `roundcube_contacts` (
  `contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL DEFAULT '',
  `email` text NOT NULL,
  `firstname` varchar(128) NOT NULL DEFAULT '',
  `surname` varchar(128) NOT NULL DEFAULT '',
  `vcard` longtext,
  `words` text,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`contact_id`),
  KEY `roundcube_user_contacts_index` (`user_id`,`del`),
  CONSTRAINT `roundcube_user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_dictionary`;
CREATE TABLE `roundcube_dictionary` (
  `user_id` int(10) unsigned DEFAULT NULL,
  `language` varchar(5) NOT NULL,
  `data` longtext NOT NULL,
  UNIQUE KEY `uniqueness` (`user_id`,`language`),
  CONSTRAINT `roundcube_user_id_fk_dictionary` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_identities`;
CREATE TABLE `roundcube_identities` (
  `identity_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `standard` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `organization` varchar(128) NOT NULL DEFAULT '',
  `email` varchar(128) NOT NULL,
  `reply-to` varchar(128) NOT NULL DEFAULT '',
  `bcc` varchar(128) NOT NULL DEFAULT '',
  `signature` longtext,
  `html_signature` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`identity_id`),
  KEY `user_identities_index` (`user_id`,`del`),
  KEY `email_identities_index` (`email`,`del`),
  CONSTRAINT `roundcube_user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_searches`;
CREATE TABLE `roundcube_searches` (
  `search_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `type` int(3) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `data` text,
  PRIMARY KEY (`search_id`),
  UNIQUE KEY `uniqueness` (`user_id`,`type`,`name`),
  CONSTRAINT `roundcube_user_id_fk_searches` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `roundcube_users_autologin`;
CREATE TABLE `roundcube_users_autologin` (
  `rcuser_id` int(10) unsigned NOT NULL,
  `crmuser_id` int(10) NOT NULL,
  KEY `rcuser_id` (`rcuser_id`),
  CONSTRAINT `roundcube_users_autologin_ibfk_1` FOREIGN KEY (`rcuser_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossmailscanner_folders_uid`;
CREATE TABLE `vtiger_ossmailscanner_folders_uid` (
  `user_id` int(10) unsigned DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `folder` varchar(100) DEFAULT NULL,
  `uid` int(10) DEFAULT '0',
  KEY `user_id` (`user_id`),
  KEY `folder` (`folder`),
  CONSTRAINT `vtiger_ossmailscanner_folders_uid_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_mail_quantities`;
CREATE TABLE `yetiforce_mail_quantities` (
  `userid` int(10) unsigned NOT NULL,
  `num` int(10) unsigned DEFAULT '0',
  `status` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`userid`),
  CONSTRAINT `yetiforce_mail_quantities_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `s_yf_mail_queue`;
CREATE TABLE `s_yf_mail_queue` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `smtp_id` int(10) unsigned NOT NULL DEFAULT '1',
  `date` datetime NOT NULL,
  `owner` int(10) NOT NULL,
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `from` text,
  `subject` text,
  `to` text,
  `content` mediumtext,
  `cc` text,
  `bcc` text,
  `attachments` text,
  `priority` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `smtp_id` (`smtp_id`),
  CONSTRAINT `s_yf_mail_queue_ibfk_1` FOREIGN KEY (`smtp_id`) REFERENCES `s_yf_mail_smtp` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=11910 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_campaignscf`;
CREATE TABLE `vtiger_campaignscf` (
  `campaignid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`campaignid`),
  CONSTRAINT `fk_1_vtiger_campaignscf` FOREIGN KEY (`campaignid`) REFERENCES `vtiger_campaign` (`campaignid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_announcement`;
CREATE TABLE `u_yf_announcement` (
  `announcementid` int(10) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `announcement_no` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `announcementstatus` varchar(255) NOT NULL DEFAULT '',
  `interval` smallint(5) DEFAULT NULL,
  `is_mandatory` smallint(5) DEFAULT NULL,
  PRIMARY KEY (`announcementid`),
  KEY `announcementstatus` (`announcementstatus`),
  CONSTRAINT `fk_1_u_yf_announcement` FOREIGN KEY (`announcementid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cfixedassets`;
CREATE TABLE `u_yf_cfixedassets` (
  `cfixedassetsid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `fixed_assets_type` varchar(255) DEFAULT NULL,
  `fixed_assets_status` varchar(255) DEFAULT NULL,
  `producent_designation` varchar(255) DEFAULT NULL,
  `additional_designation` varchar(255) DEFAULT NULL,
  `internal_designation` varchar(255) DEFAULT NULL,
  `date_production` date DEFAULT NULL,
  `date_acquisition` date DEFAULT NULL,
  `purchase_price` decimal(25,8) DEFAULT NULL,
  `actual_price` decimal(25,8) DEFAULT NULL,
  `reservation` smallint(1) DEFAULT NULL,
  `pscategory` varchar(255) DEFAULT NULL,
  `fixed_assets_fuel_type` varchar(255) DEFAULT NULL,
  `timing_change` int(10) DEFAULT '0',
  `oil_change` int(10) DEFAULT NULL,
  `fuel_consumption` int(10) DEFAULT NULL,
  `current_odometer_reading` int(10) DEFAULT NULL,
  `number_repair` smallint(5) DEFAULT NULL,
  `date_last_repair` date DEFAULT NULL,
  PRIMARY KEY (`cfixedassetsid`),
  CONSTRAINT `fk_1_vtiger_cfixedassetscfixedassetsid` FOREIGN KEY (`cfixedassetsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cinternaltickets`;
CREATE TABLE `u_yf_cinternaltickets` (
  `cinternalticketsid` int(10) NOT NULL,
  `subject` varchar(100) DEFAULT NULL,
  `cinternaltickets_no` varchar(32) DEFAULT NULL,
  `internal_tickets_status` varchar(150) DEFAULT NULL,
  `resolution` text,
  `modulo` int(11) unsigned DEFAULT '0',
  `ente` varchar(255) DEFAULT '',
  `actividadcmf` varchar(255) DEFAULT '',
  `actividadliquidador` varchar(255) DEFAULT '',
  `actividadcorredor` varchar(255) DEFAULT '',
  `actividadcia` varchar(255) DEFAULT '',
  `actividadasegurado` varchar(255) DEFAULT '',
  `fechaactpendiente` date DEFAULT NULL,
  `fechaactrealizada` date DEFAULT NULL,
  `fechaactconcluida` date DEFAULT NULL,
  `descripcionact` text,
  `comentariosact` text,
  `solucionact` text,
  PRIMARY KEY (`cinternalticketsid`),
  KEY `u_yf_cinternaltickets_modulo_idx` (`modulo`),
  CONSTRAINT `fk_1_vtiger_cinternalticketscinternalticketsid` FOREIGN KEY (`cinternalticketsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cliente_demanda`;
CREATE TABLE `u_yf_cliente_demanda` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_cliente_demanda_crmid_idx` (`crmid`),
  KEY `u_yf_cliente_demanda_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_cliente_demanda` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_cliente_demanda` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cmileagelogbook`;
CREATE TABLE `u_yf_cmileagelogbook` (
  `cmileagelogbookid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `cmileage_logbook_status` varchar(150) DEFAULT NULL,
  `number_kilometers` decimal(13,2) DEFAULT NULL,
  PRIMARY KEY (`cmileagelogbookid`),
  CONSTRAINT `fk_1_vtiger_cmileagelogbookcmileagelogbookid` FOREIGN KEY (`cmileagelogbookid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_competition`;
CREATE TABLE `u_yf_competition` (
  `competitionid` int(10) NOT NULL DEFAULT '0',
  `competition_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `vat_id` varchar(30) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `email` varchar(100) DEFAULT '',
  `active` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`competitionid`),
  CONSTRAINT `fk_1_u_yf_competition` FOREIGN KEY (`competitionid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_crmentity_last_changes`;
CREATE TABLE `u_yf_crmentity_last_changes` (
  `crmid` int(10) NOT NULL,
  `fieldname` varchar(50) NOT NULL,
  `user_id` int(10) NOT NULL,
  `date_updated` datetime NOT NULL,
  KEY `crmid` (`crmid`,`fieldname`),
  CONSTRAINT `u_yf_crmentity_last_changes_ibfk_1` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_crmentity_showners`;
CREATE TABLE `u_yf_crmentity_showners` (
  `crmid` int(10) DEFAULT NULL,
  `userid` smallint(5) unsigned NOT NULL,
  UNIQUE KEY `mix` (`crmid`,`userid`),
  KEY `crmid` (`crmid`),
  KEY `userid` (`userid`),
  CONSTRAINT `fk_u_yf_crmentity_showners` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_demandacomercial_gestcomdda`;
CREATE TABLE `u_yf_demandacomercial_gestcomdda` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_demandacomercial_gestcomdda_crmid_idx` (`crmid`),
  KEY `u_yf_demandacomercial_gestcomdda_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_demandacomercial_gestcomdda` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_demandacomercial_gestcomdda` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_demandapagoretenido_gestcomdda`;
CREATE TABLE `u_yf_demandapagoretenido_gestcomdda` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_demandapagoretenido_gestcomdda_crmid_idx` (`crmid`),
  KEY `u_yf_demandapagoretenido_gestcomdda_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_demandapagoretenido_gestcomdda` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_demandapagoretenido_gestcomdda` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_documents_emailtemplates`;
CREATE TABLE `u_yf_documents_emailtemplates` (
  `crmid` int(10) DEFAULT NULL,
  `relcrmid` int(10) DEFAULT NULL,
  KEY `u_yf_documents_emailtemplates_crmid_idx` (`crmid`),
  KEY `u_yf_documents_emailtemplates_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_documents_emailtemplates` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_documents_emailtemplates` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_emailtemplates`;
CREATE TABLE `u_yf_emailtemplates` (
  `emailtemplatesid` int(10) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `email_template_type` varchar(50) DEFAULT NULL,
  `module` varchar(50) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `content` text,
  `sys_name` varchar(50) DEFAULT NULL,
  `email_template_priority` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`emailtemplatesid`),
  KEY `sys_name` (`sys_name`),
  CONSTRAINT `fk_1_vtiger_emailtemplatesemailtemplatesid` FOREIGN KEY (`emailtemplatesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_favorites`;
CREATE TABLE `u_yf_favorites` (
  `crmid` int(10) DEFAULT NULL,
  `module` varchar(30) DEFAULT NULL,
  `relcrmid` int(10) DEFAULT NULL,
  `relmodule` varchar(30) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL,
  `data` timestamp NULL DEFAULT NULL,
  KEY `crmid` (`crmid`),
  KEY `relcrmid` (`relcrmid`),
  KEY `mix` (`crmid`,`module`,`relcrmid`,`relmodule`,`userid`),
  CONSTRAINT `fk_1_u_yf_favorites` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_u_yf_favorites` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_fbookkeeping`;
CREATE TABLE `u_yf_fbookkeeping` (
  `fbookkeepingid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `related_to` int(10) DEFAULT NULL,
  PRIMARY KEY (`fbookkeepingid`),
  KEY `related_to` (`related_to`),
  CONSTRAINT `u_yf_fbookkeeping_ibfk_1` FOREIGN KEY (`fbookkeepingid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_fcorectinginvoice`;
CREATE TABLE `u_yf_fcorectinginvoice` (
  `fcorectinginvoiceid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `fcorectinginvoice_formpayment` varchar(255) DEFAULT '',
  `sum_total` decimal(16,5) DEFAULT NULL,
  `sum_gross` decimal(16,5) DEFAULT NULL,
  `fcorectinginvoice_status` varchar(255) DEFAULT '',
  `finvoiceid` int(10) DEFAULT NULL,
  PRIMARY KEY (`fcorectinginvoiceid`),
  KEY `accountid` (`accountid`),
  KEY `finvoiceid` (`finvoiceid`),
  CONSTRAINT `fk_1_vtiger_fcorectinginvoice` FOREIGN KEY (`fcorectinginvoiceid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoice`;
CREATE TABLE `u_yf_finvoice` (
  `finvoiceid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `finvoice_formpayment` varchar(255) DEFAULT '',
  `sum_total` decimal(16,5) DEFAULT NULL,
  `sum_gross` decimal(16,5) DEFAULT NULL,
  `finvoice_status` varchar(255) DEFAULT '',
  `finvoice_paymentstatus` varchar(255) DEFAULT NULL,
  `finvoice_type` varchar(255) DEFAULT NULL,
  `pscategory` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`finvoiceid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_vtiger_finvoice` FOREIGN KEY (`finvoiceid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoicecost`;
CREATE TABLE `u_yf_finvoicecost` (
  `finvoicecostid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `finvoicecost_formpayment` varchar(255) DEFAULT '',
  `sum_total` decimal(16,5) DEFAULT NULL,
  `sum_gross` decimal(16,5) DEFAULT NULL,
  `finvoicecost_status` varchar(255) DEFAULT '',
  `finvoicecost_paymentstatus` varchar(255) DEFAULT NULL,
  `pscategory` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`finvoicecostid`),
  CONSTRAINT `fk_1_vtiger_finvoicecost` FOREIGN KEY (`finvoicecostid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoiceproforma`;
CREATE TABLE `u_yf_finvoiceproforma` (
  `finvoiceproformaid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `finvoiceproforma_formpayment` varchar(255) DEFAULT NULL,
  `sum_total` decimal(15,2) DEFAULT NULL,
  `sum_gross` decimal(13,2) DEFAULT NULL,
  `finvoiceproforma_status` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`finvoiceproformaid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_vtiger_finvoiceproforma` FOREIGN KEY (`finvoiceproformaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igdn`;
CREATE TABLE `u_yf_igdn` (
  `igdnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igdn_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `ssingleordersid` int(10) DEFAULT NULL,
  PRIMARY KEY (`igdnid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  KEY `ssingleordersid` (`ssingleordersid`),
  CONSTRAINT `u_yf_igdn_ibfk_1` FOREIGN KEY (`igdnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igdnc`;
CREATE TABLE `u_yf_igdnc` (
  `igdncid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igdnc_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `igdnid` int(10) DEFAULT NULL,
  PRIMARY KEY (`igdncid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  KEY `igdnid` (`igdnid`),
  CONSTRAINT `u_yf_igdnc_ibfk_1` FOREIGN KEY (`igdncid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igin`;
CREATE TABLE `u_yf_igin` (
  `iginid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igin_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  PRIMARY KEY (`iginid`),
  KEY `storageid` (`storageid`),
  CONSTRAINT `u_yf_igin_ibfk_1` FOREIGN KEY (`iginid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igrn`;
CREATE TABLE `u_yf_igrn` (
  `igrnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igrn_status` varchar(255) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  PRIMARY KEY (`igrnid`),
  KEY `storageid` (`storageid`),
  KEY `vendorid` (`vendorid`),
  CONSTRAINT `u_yf_igrn_ibfk_1` FOREIGN KEY (`igrnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igrnc`;
CREATE TABLE `u_yf_igrnc` (
  `igrncid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igrnc_status` varchar(255) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `igrnid` int(10) DEFAULT NULL,
  PRIMARY KEY (`igrncid`),
  KEY `storageid` (`storageid`),
  KEY `vendorid` (`vendorid`),
  KEY `igrnid` (`igrnid`),
  CONSTRAINT `u_yf_igrnc_ibfk_1` FOREIGN KEY (`igrncid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_iidn`;
CREATE TABLE `u_yf_iidn` (
  `iidnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `iidn_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  PRIMARY KEY (`iidnid`),
  KEY `storageid` (`storageid`),
  CONSTRAINT `u_yf_iidn_ibfk_1` FOREIGN KEY (`iidnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ipreorder`;
CREATE TABLE `u_yf_ipreorder` (
  `ipreorderid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `ipreorder_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  PRIMARY KEY (`ipreorderid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `u_yf_ipreorder_ibfk_1` FOREIGN KEY (`ipreorderid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istdn`;
CREATE TABLE `u_yf_istdn` (
  `istdnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `istdn_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  PRIMARY KEY (`istdnid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  KEY `process` (`process`),
  KEY `subprocess` (`subprocess`),
  CONSTRAINT `u_yf_istdn_ibfk_1` FOREIGN KEY (`istdnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istn`;
CREATE TABLE `u_yf_istn` (
  `istnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `istn_status` varchar(255) DEFAULT NULL,
  `estimated_date` date DEFAULT NULL,
  `istn_type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`istnid`),
  CONSTRAINT `u_yf_istn_ibfk_1` FOREIGN KEY (`istnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istorages`;
CREATE TABLE `u_yf_istorages` (
  `istorageid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `storage_status` varchar(255) DEFAULT '',
  `storage_type` varchar(255) DEFAULT '',
  `parentid` int(10) DEFAULT NULL,
  PRIMARY KEY (`istorageid`),
  KEY `parentid` (`parentid`),
  CONSTRAINT `u_yf_istorages_ibfk_1` FOREIGN KEY (`istorageid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istorages_products`;
CREATE TABLE `u_yf_istorages_products` (
  `crmid` int(10) DEFAULT NULL,
  `relcrmid` int(10) DEFAULT NULL,
  `qtyinstock` decimal(25,3) DEFAULT NULL,
  KEY `crmid` (`crmid`),
  KEY `relcrmid` (`relcrmid`),
  CONSTRAINT `u_yf_istorages_products_ibfk_1` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `u_yf_istorages_products_ibfk_2` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istrn`;
CREATE TABLE `u_yf_istrn` (
  `istrnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `istrn_status` varchar(255) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  PRIMARY KEY (`istrnid`),
  KEY `storageid` (`storageid`),
  KEY `vendorid` (`vendorid`),
  KEY `process` (`process`),
  KEY `subprocess` (`subprocess`),
  CONSTRAINT `u_yf_istrn_ibfk_1` FOREIGN KEY (`istrnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_knowledgebase`;
CREATE TABLE `u_yf_knowledgebase` (
  `knowledgebaseid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `content` text,
  `category` varchar(200) DEFAULT NULL,
  `knowledgebase_view` varchar(255) DEFAULT NULL,
  `knowledgebase_status` varchar(255) DEFAULT '',
  PRIMARY KEY (`knowledgebaseid`),
  CONSTRAINT `fk_1_vtiger_knowledgebase` FOREIGN KEY (`knowledgebaseid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_mail_address_book`;
CREATE TABLE `u_yf_mail_address_book` (
  `id` int(10) NOT NULL,
  `email` varchar(100) NOT NULL,
  `name` varchar(255) NOT NULL,
  `users` text NOT NULL,
  KEY `email` (`email`,`name`),
  KEY `id` (`id`),
  CONSTRAINT `u_yf_mail_address_book_ibfk_1` FOREIGN KEY (`id`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_multicompany`;
CREATE TABLE `u_yf_multicompany` (
  `multicompanyid` int(11) NOT NULL,
  `company_name` varchar(255) DEFAULT NULL,
  `parent_id` int(10) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `mulcomp_status` varchar(255) DEFAULT NULL,
  `email1` varchar(100) DEFAULT NULL,
  `email2` varchar(100) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `phone_extra` varchar(100) DEFAULT NULL,
  `mobile` varchar(30) DEFAULT NULL,
  `mobile_extra` varchar(100) DEFAULT NULL,
  `fax` varchar(30) DEFAULT NULL,
  `fax_extra` varchar(100) DEFAULT NULL,
  `vat` varchar(255) DEFAULT NULL,
  `companyid1` varchar(255) DEFAULT NULL,
  `companyid2` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`multicompanyid`),
  KEY `multicompany_parent_id_idx` (`parent_id`),
  CONSTRAINT `fk_1_u_yf_multicompanymulticompanyid` FOREIGN KEY (`multicompanyid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_notification`;
CREATE TABLE `u_yf_notification` (
  `notificationid` int(10) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `number` varchar(50) DEFAULT NULL,
  `notification_status` varchar(255) DEFAULT NULL,
  `notification_type` varchar(255) DEFAULT '',
  `link` int(10) DEFAULT NULL,
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  `linkextend` int(10) DEFAULT NULL,
  `notificacioncliente` int(11) unsigned DEFAULT '0',
  `gestcomdda` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`notificationid`),
  KEY `link` (`link`),
  KEY `process` (`process`),
  KEY `subprocess` (`subprocess`),
  KEY `linkextend` (`linkextend`),
  KEY `u_yf_notification_notificacioncliente_idx` (`notificacioncliente`),
  KEY `u_yf_notification_gestcomdda_idx` (`gestcomdda`),
  CONSTRAINT `fk_1_notification` FOREIGN KEY (`notificationid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_partners`;
CREATE TABLE `u_yf_partners` (
  `partnersid` int(10) NOT NULL DEFAULT '0',
  `partners_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `vat_id` varchar(30) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `email` varchar(100) DEFAULT '',
  `active` tinyint(1) DEFAULT '0',
  `category` varchar(255) DEFAULT '',
  PRIMARY KEY (`partnersid`),
  CONSTRAINT `fk_1_u_yf_partners` FOREIGN KEY (`partnersid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_prueba_suscripcion`;
CREATE TABLE `u_yf_prueba_suscripcion` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_prueba_suscripcion_crmid_idx` (`crmid`),
  KEY `u_yf_prueba_suscripcion_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_prueba_suscripcion` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_prueba_suscripcion` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_scalculations`;
CREATE TABLE `u_yf_scalculations` (
  `scalculationsid` int(10) NOT NULL DEFAULT '0',
  `scalculations_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `srequirementscardsid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `scalculations_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `sum_total` decimal(28,8) DEFAULT NULL,
  `sum_marginp` decimal(10,2) DEFAULT NULL,
  `sum_margin` decimal(28,8) DEFAULT NULL,
  PRIMARY KEY (`scalculationsid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `accountid` (`accountid`),
  KEY `srequirementscardsid` (`srequirementscardsid`),
  CONSTRAINT `fk_1_u_yf_scalculations` FOREIGN KEY (`scalculationsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squoteenquiries`;
CREATE TABLE `u_yf_squoteenquiries` (
  `squoteenquiriesid` int(10) NOT NULL DEFAULT '0',
  `squoteenquiries_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `squoteenquiries_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`squoteenquiriesid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_u_yf_squoteenquiries` FOREIGN KEY (`squoteenquiriesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squotes`;
CREATE TABLE `u_yf_squotes` (
  `squotesid` int(10) NOT NULL DEFAULT '0',
  `squotes_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `scalculationsid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `squotes_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `company` varchar(255) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `sum_total` decimal(28,8) DEFAULT NULL,
  `sum_marginp` decimal(10,2) DEFAULT NULL,
  `sum_margin` decimal(28,8) DEFAULT NULL,
  `sum_gross` decimal(28,8) DEFAULT NULL,
  `sum_discount` decimal(28,8) DEFAULT NULL,
  `valid_until` date DEFAULT NULL,
  PRIMARY KEY (`squotesid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `scalculationsid` (`scalculationsid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_u_yf_squotes` FOREIGN KEY (`squotesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srecurringorders`;
CREATE TABLE `u_yf_srecurringorders` (
  `srecurringordersid` int(10) NOT NULL DEFAULT '0',
  `srecurringorders_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `squotesid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `srecurringorders_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `date_start` date DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `duedate` date DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `company` varchar(255) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`srecurringordersid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `squotesid` (`squotesid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_u_yf_srecurringorders` FOREIGN KEY (`srecurringordersid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srequirementscards`;
CREATE TABLE `u_yf_srequirementscards` (
  `srequirementscardsid` int(10) NOT NULL DEFAULT '0',
  `srequirementscards_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `quoteenquiryid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `srequirementscards_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`srequirementscardsid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `accountid` (`accountid`),
  KEY `quoteenquiryid` (`quoteenquiryid`),
  CONSTRAINT `fk_1_u_yf_srequirementscards` FOREIGN KEY (`srequirementscardsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ssalesprocesses`;
CREATE TABLE `u_yf_ssalesprocesses` (
  `ssalesprocessesid` int(10) NOT NULL DEFAULT '0',
  `ssalesprocesses_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `related_to` int(10) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `estimated` decimal(25,8) DEFAULT NULL,
  `actual_sale` decimal(25,8) DEFAULT NULL,
  `estimated_date` date DEFAULT NULL,
  `actual_date` date DEFAULT NULL,
  `probability` decimal(5,2) DEFAULT NULL,
  `ssalesprocesses_source` varchar(255) DEFAULT NULL,
  `ssalesprocesses_type` varchar(255) DEFAULT NULL,
  `ssalesprocesses_status` varchar(255) DEFAULT NULL,
  `campaignid` int(10) DEFAULT NULL,
  `parentid` int(10) DEFAULT '0',
  `startdate` date DEFAULT NULL,
  PRIMARY KEY (`ssalesprocessesid`),
  KEY `related_to` (`related_to`),
  KEY `campaignid` (`campaignid`),
  KEY `parentid` (`parentid`),
  KEY `ssalesprocesses_no` (`ssalesprocesses_no`),
  CONSTRAINT `fk_1_u_yf_ssalesprocesses` FOREIGN KEY (`ssalesprocessesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ssingleorders`;
CREATE TABLE `u_yf_ssingleorders` (
  `ssingleordersid` int(10) NOT NULL DEFAULT '0',
  `ssingleorders_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `squotesid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `ssingleorders_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `date_start` date DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `duedate` date DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `company` varchar(255) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `sum_total` decimal(28,8) DEFAULT NULL,
  `sum_marginp` decimal(10,2) DEFAULT NULL,
  `sum_margin` decimal(28,8) DEFAULT NULL,
  `sum_gross` decimal(28,8) DEFAULT NULL,
  `sum_discount` decimal(28,8) DEFAULT NULL,
  `ssingleorders_source` varchar(255) DEFAULT '',
  PRIMARY KEY (`ssingleordersid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `squotesid` (`squotesid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_u_yf_ssingleorders` FOREIGN KEY (`ssingleordersid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_svendorenquiries`;
CREATE TABLE `u_yf_svendorenquiries` (
  `svendorenquiriesid` int(10) NOT NULL DEFAULT '0',
  `svendorenquiries_no` varchar(50) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `category` varchar(30) DEFAULT NULL,
  `svendorenquiries_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `sum_total` decimal(28,8) DEFAULT NULL,
  `sum_marginp` decimal(10,2) DEFAULT NULL,
  `sum_margin` decimal(28,8) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `scalculationsid` int(10) DEFAULT NULL,
  PRIMARY KEY (`svendorenquiriesid`),
  KEY `svendorenquiries_salesprocessid_idx` (`salesprocessid`),
  KEY `svendorenquiries_accountid_idx` (`accountid`),
  KEY `svendorenquiries_vendorid_idx` (`vendorid`),
  KEY `svendorenquiries_scalculationsid_idx` (`scalculationsid`),
  CONSTRAINT `fk_1_u_yf_svendorenquiries` FOREIGN KEY (`svendorenquiriesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_timeline`;
CREATE TABLE `u_yf_timeline` (
  `crmid` int(10) NOT NULL,
  `type` varchar(50) DEFAULT NULL,
  `userid` int(10) NOT NULL,
  KEY `timeline_crmid_idx` (`crmid`),
  CONSTRAINT `fk_1_u_yf_timeline` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_watchdog_record`;
CREATE TABLE `u_yf_watchdog_record` (
  `userid` int(10) unsigned NOT NULL,
  `record` int(10) NOT NULL,
  `state` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`userid`,`record`),
  KEY `userid` (`userid`),
  KEY `record` (`record`),
  KEY `userid_2` (`userid`,`record`,`state`),
  CONSTRAINT `u_yf_watchdog_record_ibfk_1` FOREIGN KEY (`record`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_DemandaPagoRetenido`;
CREATE TABLE `vtiger_DemandaPagoRetenido` (
  `DemandaPagoRetenidoid` int(11) NOT NULL DEFAULT '0',
  `id` int(11) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `inf_dda_presentada` tinyint(1) DEFAULT '0',
  `fecha_inf_dda_presentada` date DEFAULT NULL,
  `cert_pjudenv` tinyint(1) DEFAULT '0',
  `fech_envcertpjud` date DEFAULT NULL,
  `rol` varchar(15) DEFAULT '',
  `caratula` varchar(150) DEFAULT '',
  `dda_presentada` tinyint(1) DEFAULT '0',
  `fech_dda_presentada` varchar(50) DEFAULT NULL,
  `rut` varchar(15) DEFAULT '',
  `tribunalcompetente` varchar(255) DEFAULT '',
  `tribunalradicado` varchar(255) DEFAULT '',
  `estadodda` varchar(255) DEFAULT '',
  `bienesembargados` varchar(255) DEFAULT '',
  `cortecompetente` varchar(255) DEFAULT '',
  `rolrecursoqueja` varchar(30) DEFAULT '',
  `clasedeapelacion` varchar(255) DEFAULT '',
  `rolapelacion` varchar(30) DEFAULT '',
  `clasecasacion` varchar(255) DEFAULT '',
  `rolrecursocasacion` varchar(20) DEFAULT '',
  `rolrecursohecho` varchar(30) DEFAULT '',
  `generardda` tinyint(1) DEFAULT '0',
  `generarcumpleord` tinyint(1) DEFAULT '0',
  `genart44` tinyint(1) DEFAULT '0',
  `generarformato` tinyint(1) DEFAULT '0',
  `generarautoprueba` tinyint(1) DEFAULT '0',
  `generaroirsentencia` tinyint(1) DEFAULT '0',
  `generarreposicion` tinyint(1) DEFAULT '0',
  `generarrepoyapela` tinyint(1) DEFAULT '0',
  `generarapela` tinyint(1) DEFAULT '0',
  `formatoica` tinyint(1) DEFAULT '0',
  `nombrereceptor` varchar(255) DEFAULT '',
  `busquedanegativa` bigint(30) DEFAULT '0',
  `estadobusqueda` varchar(255) DEFAULT '',
  `not44` bigint(30) DEFAULT '0',
  `estadonot44` varchar(255) DEFAULT '',
  `notporcedula` bigint(30) DEFAULT '0',
  `estadonotcedula` varchar(255) DEFAULT '',
  `notpersonal` bigint(30) DEFAULT '0',
  `estadonotpersonal` varchar(255) DEFAULT '',
  `embargo` bigint(30) DEFAULT '0',
  `estadoembargo` varchar(255) DEFAULT '',
  `preciobusqueda` bigint(30) DEFAULT '0',
  `precionotcedula` bigint(30) DEFAULT '0',
  `precionot44` bigint(30) DEFAULT '0',
  `precioembargo` bigint(30) DEFAULT '0',
  `precionotpersonal` bigint(30) DEFAULT '0',
  `totalapagar` bigint(30) DEFAULT '0',
  `pagar` tinyint(1) DEFAULT '0',
  `pagohistorico` bigint(30) DEFAULT '0',
  `comunacliente` varchar(255) DEFAULT '',
  `comuna` varchar(255) DEFAULT '',
  `correo` varchar(100) DEFAULT '',
  `movil` varchar(50) DEFAULT '',
  `rutcomp` varchar(255) DEFAULT '',
  `siniestro` int(11) unsigned DEFAULT '0',
  `demandadoid` int(11) unsigned DEFAULT '0',
  `relacionventaddas` int(11) unsigned DEFAULT '0',
  `relgestcom` int(11) unsigned DEFAULT '0',
  `tiposervicio` varchar(255) DEFAULT '',
  PRIMARY KEY (`DemandaPagoRetenidoid`),
  KEY `vtiger_DemandaPagoRetenido_siniestro_idx` (`siniestro`),
  KEY `vtiger_DemandaPagoRetenido_demandadoid_idx` (`demandadoid`),
  KEY `vtiger_DemandaPagoRetenido_relacionventaddas_idx` (`relacionventaddas`),
  KEY `vtiger_DemandaPagoRetenido_relgestcom_idx` (`relgestcom`),
  CONSTRAINT `fk_1_vtiger_DemandaPagoRetenidoDemandaPagoRetenidoid` FOREIGN KEY (`DemandaPagoRetenidoid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_account`;
CREATE TABLE `vtiger_account` (
  `accountid` int(10) NOT NULL DEFAULT '0',
  `account_no` varchar(100) NOT NULL,
  `accountname` varchar(100) NOT NULL,
  `parentid` int(10) DEFAULT '0',
  `account_type` varchar(200) DEFAULT NULL,
  `industry` varchar(200) DEFAULT NULL,
  `annualrevenue` decimal(25,8) DEFAULT NULL,
  `ownership` varchar(50) DEFAULT NULL,
  `siccode` varchar(50) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `otherphone` varchar(30) DEFAULT NULL,
  `email1` varchar(100) DEFAULT NULL,
  `email2` varchar(100) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `fax` varchar(30) DEFAULT NULL,
  `employees` int(10) DEFAULT '0',
  `emailoptout` smallint(1) DEFAULT '0',
  `isconvertedfromlead` smallint(3) DEFAULT '0',
  `vat_id` varchar(30) DEFAULT NULL,
  `registration_number_1` varchar(30) DEFAULT NULL,
  `registration_number_2` varchar(30) DEFAULT NULL,
  `verification` text,
  `no_approval` smallint(1) DEFAULT '0',
  `balance` decimal(25,8) DEFAULT NULL,
  `payment_balance` decimal(25,8) DEFAULT NULL,
  `legal_form` varchar(255) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT NULL,
  `inventorybalance` decimal(25,8) DEFAULT '0.00000000',
  `discount` decimal(5,2) DEFAULT '0.00',
  `creditlimit` int(10) DEFAULT NULL,
  `products` text,
  `services` text,
  `last_invoice_date` date DEFAULT NULL,
  `active` tinyint(1) DEFAULT '0',
  `accounts_status` varchar(255) DEFAULT NULL,
  `phone_extra` varchar(100) DEFAULT NULL,
  `fax_extra` varchar(100) DEFAULT NULL,
  `otherphone_extra` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`accountid`),
  KEY `account_account_type_idx` (`account_type`),
  KEY `email_idx` (`email1`,`email2`),
  KEY `accountname` (`accountname`),
  KEY `parentid` (`parentid`),
  CONSTRAINT `fk_1_vtiger_account` FOREIGN KEY (`accountid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_activity`;
CREATE TABLE `vtiger_activity` (
  `activityid` int(10) NOT NULL DEFAULT '0',
  `subject` varchar(100) NOT NULL,
  `activitytype` varchar(200) NOT NULL,
  `date_start` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `time_start` time DEFAULT NULL,
  `time_end` time DEFAULT NULL,
  `sendnotification` smallint(1) NOT NULL DEFAULT '0',
  `duration_hours` smallint(5) DEFAULT NULL,
  `duration_minutes` smallint(3) DEFAULT NULL,
  `status` varchar(200) DEFAULT NULL,
  `priority` varchar(200) DEFAULT NULL,
  `location` varchar(150) DEFAULT NULL,
  `notime` smallint(1) NOT NULL DEFAULT '0',
  `visibility` varchar(50) NOT NULL DEFAULT 'all',
  `deleted` tinyint(1) DEFAULT '0',
  `smownerid` smallint(5) unsigned DEFAULT NULL,
  `allday` tinyint(1) DEFAULT NULL,
  `dav_status` tinyint(1) DEFAULT '1',
  `state` varchar(255) DEFAULT NULL,
  `link` int(10) DEFAULT NULL,
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  `followup` int(10) DEFAULT NULL,
  `reapeat` smallint(1) DEFAULT NULL,
  `recurrence` text,
  `linkextend` int(10) DEFAULT NULL,
  `nrocaso` int(11) unsigned DEFAULT '0',
  `nrocaso2` int(11) unsigned DEFAULT '0',
  `detactividad` varchar(255) DEFAULT '',
  PRIMARY KEY (`activityid`),
  KEY `activity_activityid_subject_idx` (`activityid`,`subject`),
  KEY `activity_activitytype_date_start_idx` (`activitytype`,`date_start`),
  KEY `activity_date_start_due_date_idx` (`date_start`,`due_date`),
  KEY `activity_date_start_time_start_idx` (`date_start`,`time_start`),
  KEY `activity_status_idx` (`status`),
  KEY `activitytype_2` (`activitytype`,`date_start`,`due_date`,`time_start`,`time_end`,`deleted`,`smownerid`),
  KEY `link` (`link`),
  KEY `process` (`process`),
  KEY `followup` (`followup`),
  KEY `subprocess` (`subprocess`),
  KEY `activitytype_3` (`activitytype`,`status`),
  KEY `smownerid` (`smownerid`),
  KEY `linkextend` (`linkextend`),
  KEY `vtiger_activity_nrocaso_idx` (`nrocaso`),
  KEY `vtiger_activity_nrocaso2_idx` (`nrocaso2`),
  CONSTRAINT `fk_1_vtiger_activity` FOREIGN KEY (`activityid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_assets`;
CREATE TABLE `vtiger_assets` (
  `assetsid` int(10) NOT NULL,
  `asset_no` varchar(30) NOT NULL,
  `product` int(10) NOT NULL,
  `serialnumber` varchar(200) DEFAULT NULL,
  `datesold` date DEFAULT NULL,
  `dateinservice` date DEFAULT NULL,
  `assetstatus` varchar(200) DEFAULT 'PLL_DRAFT',
  `assetname` varchar(100) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `parent_id` int(10) DEFAULT NULL,
  `ordertime` decimal(10,2) DEFAULT NULL,
  `pscategory` varchar(255) DEFAULT '',
  `ssalesprocessesid` int(10) DEFAULT NULL,
  `assets_renew` varchar(255) DEFAULT NULL,
  `renewalinvoice` int(10) DEFAULT NULL,
  `contactid` int(19) DEFAULT NULL,
  PRIMARY KEY (`assetsid`),
  KEY `parent_id` (`parent_id`),
  KEY `product` (`product`),
  KEY `ssalesprocessesid` (`ssalesprocessesid`),
  KEY `renewalinvoice` (`renewalinvoice`),
  KEY `contactid_idx` (`contactid`),
  CONSTRAINT `fk_1_vtiger_assets` FOREIGN KEY (`assetsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_attachments`;
CREATE TABLE `vtiger_attachments` (
  `attachmentsid` int(10) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text,
  `type` varchar(100) DEFAULT NULL,
  `path` text,
  `subject` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`attachmentsid`),
  CONSTRAINT `fk_1_vtiger_attachments` FOREIGN KEY (`attachmentsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_callhistory`;
CREATE TABLE `vtiger_callhistory` (
  `callhistoryid` int(10) NOT NULL,
  `callhistorytype` varchar(255) DEFAULT NULL,
  `from_number` varchar(30) DEFAULT NULL,
  `to_number` varchar(30) DEFAULT NULL,
  `location` varchar(200) DEFAULT NULL,
  `phonecallid` varchar(100) DEFAULT NULL,
  `duration` int(10) DEFAULT NULL,
  `start_time` datetime DEFAULT NULL,
  `end_time` datetime DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `imei` varchar(100) DEFAULT NULL,
  `ipaddress` varchar(100) DEFAULT NULL,
  `simserial` varchar(100) DEFAULT NULL,
  `subscriberid` varchar(100) DEFAULT NULL,
  `destination` int(10) DEFAULT NULL,
  `source` int(10) DEFAULT NULL,
  `from_number_extra` varchar(100) DEFAULT NULL,
  `to_number_extra` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`callhistoryid`),
  KEY `source` (`source`),
  KEY `destination` (`destination`),
  CONSTRAINT `vtiger_callhistory_ibfk_1` FOREIGN KEY (`callhistoryid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_campaign_records`;
CREATE TABLE `vtiger_campaign_records` (
  `campaignid` int(10) NOT NULL DEFAULT '0',
  `crmid` int(10) NOT NULL DEFAULT '0',
  `campaignrelstatusid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`campaignid`,`crmid`,`campaignrelstatusid`),
  KEY `campaigncontrel_contractid_idx` (`crmid`),
  CONSTRAINT `fk_vtiger_crmentity` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_campanafacebook`;
CREATE TABLE `vtiger_campanafacebook` (
  `campanafacebookid` int(11) NOT NULL DEFAULT '0',
  `campface` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `nombrecompleto` varchar(200) DEFAULT '',
  `telefono` varchar(20) DEFAULT '',
  `correo` varchar(100) DEFAULT '',
  `ciudad` varchar(50) DEFAULT '',
  `fecharegistro` date DEFAULT NULL,
  `nombrecampana` varchar(50) DEFAULT '',
  `nombreconjuntoanuncios` varchar(50) DEFAULT '',
  `nombreanuncio` varchar(50) DEFAULT '',
  `plataforma` varchar(50) DEFAULT '',
  `cuandoquieresquqtellamen` varchar(200) DEFAULT '',
  `estadollamada` varchar(255) DEFAULT 'Por realizar',
  `estadocorreo` varchar(255) DEFAULT '',
  `fechaultimallamada` date DEFAULT NULL,
  `fechaultimocorreo` date DEFAULT NULL,
  `estadodellead` varchar(255) DEFAULT '',
  `obsgestion` text,
  `fechaproximallamada` date DEFAULT NULL,
  `numerocaso` varchar(10) DEFAULT '',
  `motivonoleinteresa` varchar(255) DEFAULT '',
  `comuna` varchar(46) DEFAULT '',
  `tieneshipotecario` varchar(30) DEFAULT '',
  PRIMARY KEY (`campanafacebookid`),
  CONSTRAINT `fk_1_vtiger_campanafacebookcampanafacebookid` FOREIGN KEY (`campanafacebookid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_campanasmktdigital`;
CREATE TABLE `vtiger_campanasmktdigital` (
  `campanasmktdigitalid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(100) DEFAULT NULL,
  `tienescrehip` varchar(100) DEFAULT '',
  `comuna` varchar(100) DEFAULT '',
  `nombrecompleto` varchar(100) DEFAULT '',
  `telefono` varchar(100) DEFAULT '',
  `correo` varchar(150) DEFAULT NULL,
  `campana` varchar(150) DEFAULT NULL,
  `conjuntodeanuncios` varchar(100) DEFAULT '',
  `anuncio` varchar(100) DEFAULT '',
  `mediodigital` varchar(100) DEFAULT '',
  `motivorechazo` varchar(255) DEFAULT '',
  `fechaultimallamada` date DEFAULT NULL,
  `fechaproximallamada` datetime DEFAULT NULL,
  `estadolead` varchar(255) DEFAULT '',
  `estadollamada` varchar(255) DEFAULT '',
  `codigocampana` varchar(40) DEFAULT '',
  `mescampana` varchar(40) DEFAULT '',
  `anocampana` varchar(40) DEFAULT '',
  `last_update` date DEFAULT NULL,
  `idfacebook` varchar(100) DEFAULT '',
  `gestionadopor` varchar(255) DEFAULT '',
  `obsrechazo` varchar(240) DEFAULT '',
  `obslead` varchar(240) DEFAULT '',
  `fecha_asignado` datetime DEFAULT NULL,
  `fecha_leads` date DEFAULT NULL,
  `leadan` varchar(10) DEFAULT '0',
  `Gestion_leads` text NOT NULL,
  PRIMARY KEY (`campanasmktdigitalid`),
  CONSTRAINT `fk_1_vtiger_campanasmktdigitalcampanasmktdigitalid` FOREIGN KEY (`campanasmktdigitalid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_cargofijo`;
CREATE TABLE `vtiger_cargofijo` (
  `cargofijoid` int(11) NOT NULL DEFAULT '0',
  `montocontrato` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `siniestro` int(11) unsigned DEFAULT '0',
  `nrofactura` bigint(59) DEFAULT '0',
  `dctocontrato` bigint(32) DEFAULT '0',
  `ffactura` date DEFAULT NULL,
  `montofactura` bigint(59) DEFAULT '0',
  `fvenfactura` date DEFAULT NULL,
  `facturapagada` tinyint(1) DEFAULT '0',
  `fpagofactura` date DEFAULT NULL,
  `banco` varchar(255) DEFAULT '',
  `nrocuenta` bigint(59) DEFAULT '0',
  `tipocuenta` varchar(255) DEFAULT '',
  `sucursal` varchar(59) DEFAULT '',
  `diaspago` varchar(255) DEFAULT '',
  `nombrecliente` int(11) unsigned DEFAULT '0',
  `captador` varchar(255) DEFAULT '',
  `tipopago` varchar(255) DEFAULT '',
  `bancopago` varchar(255) DEFAULT '',
  `codwebpay` bigint(12) DEFAULT '0',
  `tarjpago` varchar(255) DEFAULT '',
  `estado` varchar(255) DEFAULT '',
  `entliquidadora` varchar(255) DEFAULT '',
  `ciudadcaso` varchar(255) DEFAULT '',
  `comunacaso` varchar(255) DEFAULT '',
  PRIMARY KEY (`cargofijoid`),
  KEY `vtiger_cargofijo_siniestro_idx` (`siniestro`),
  KEY `vtiger_cargofijo_nombrecliente_idx` (`nombrecliente`),
  CONSTRAINT `fk_1_vtiger_cargofijocargofijoid` FOREIGN KEY (`cargofijoid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_cliente`;
CREATE TABLE `vtiger_cliente` (
  `clienteid` int(11) NOT NULL DEFAULT '0',
  `cliente` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `nombre` varchar(200) DEFAULT '',
  `apellido` varchar(200) DEFAULT '',
  `serienrodocto` varchar(16) DEFAULT '',
  `movil` varchar(30) DEFAULT '',
  `movil_extra` varchar(100) DEFAULT NULL,
  `tlfparticular` varchar(30) DEFAULT '',
  `tlfparticular_extra` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT '',
  `tipocliente` varchar(255) DEFAULT '',
  `captador` varchar(255) DEFAULT '',
  `ofcaptador` varchar(255) DEFAULT '',
  `observaciones` text,
  `dircliente` text,
  `comunacliente` varchar(255) DEFAULT '',
  `ciudadcliente` varchar(255) DEFAULT '',
  `paiscliente` varchar(255) DEFAULT '',
  `clienteportal` tinyint(1) DEFAULT '0',
  `iniciosoporte` date DEFAULT NULL,
  `finsoporte` date DEFAULT NULL,
  `descripcion` text,
  `fnacimiento` date DEFAULT NULL,
  `edocivil` varchar(255) DEFAULT '',
  `estudios` varchar(255) DEFAULT '',
  `fuente` varchar(255) DEFAULT '',
  `profesion` varchar(32) DEFAULT '',
  `comunadelcliente` varchar(255) DEFAULT '',
  `provinciadelcliente` varchar(255) DEFAULT '',
  `regiondelcliente` varchar(255) DEFAULT '',
  `proviene` varchar(255) DEFAULT '',
  `password` varchar(64) DEFAULT '',
  `referido` int(11) unsigned DEFAULT '0',
  `contrasenaenviada` tinyint(1) DEFAULT '0',
  `marcaportal` tinyint(1) DEFAULT '0',
  `cli` int(11) unsigned DEFAULT '0',
  `client` int(11) unsigned DEFAULT '0',
  `idclientevd` int(11) unsigned DEFAULT '0',
  `claveportal` varchar(20) DEFAULT '',
  `sinacofi` tinyint(1) DEFAULT '0',
  `fonoarrendatario` varchar(30) DEFAULT '',
  `estadopac` varchar(255) DEFAULT '1',
  `appsuspac` text,
  `fechasuspac` date DEFAULT NULL,
  `ven_asig_pac` varchar(100) DEFAULT '',
  `enviarwp` tinyint(1) DEFAULT '0',
  `asociadoesterno` varchar(200) DEFAULT '',
  PRIMARY KEY (`clienteid`),
  KEY `vtiger_cliente_referido_idx` (`referido`),
  KEY `vtiger_cliente_cli_idx` (`cli`),
  KEY `vtiger_cliente_client_idx` (`client`),
  KEY `vtiger_cliente_idclientevd_idx` (`idclientevd`),
  CONSTRAINT `fk_1_vtiger_clienteclienteid` FOREIGN KEY (`clienteid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_clientesgarantia`;
CREATE TABLE `vtiger_clientesgarantia` (
  `clientesgarantiaid` int(11) NOT NULL,
  `clientes_garantia` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `cliente_contactado` tinyint(1) DEFAULT '0',
  `fecha_contacto` date DEFAULT NULL,
  `firma_contrato` tinyint(1) DEFAULT '0',
  `fecha_firma_asl` date DEFAULT NULL,
  PRIMARY KEY (`clientesgarantiaid`),
  CONSTRAINT `fk_1_vtiger_clientesgarantiaclientesgarantiaid` FOREIGN KEY (`clientesgarantiaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_contactdetails`;
CREATE TABLE `vtiger_contactdetails` (
  `contactid` int(10) NOT NULL DEFAULT '0',
  `contact_no` varchar(100) NOT NULL,
  `parentid` int(10) DEFAULT NULL,
  `salutation` varchar(200) DEFAULT NULL,
  `firstname` varchar(40) DEFAULT NULL,
  `lastname` varchar(80) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL,
  `mobile` varchar(50) DEFAULT NULL,
  `reportsto` varchar(30) DEFAULT NULL,
  `training` varchar(50) DEFAULT NULL,
  `usertype` varchar(50) DEFAULT NULL,
  `contacttype` varchar(50) DEFAULT NULL,
  `otheremail` varchar(100) DEFAULT NULL,
  `donotcall` smallint(1) DEFAULT NULL,
  `emailoptout` smallint(1) DEFAULT '0',
  `imagename` varchar(150) DEFAULT NULL,
  `isconvertedfromlead` smallint(1) DEFAULT '0',
  `verification` text,
  `secondary_email` varchar(100) DEFAULT '',
  `notifilanguage` varchar(100) DEFAULT '',
  `contactstatus` varchar(255) DEFAULT '',
  `dav_status` tinyint(1) DEFAULT '1',
  `jobtitle` varchar(100) DEFAULT '',
  `decision_maker` tinyint(1) DEFAULT '0',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `active` tinyint(1) DEFAULT '0',
  `phone_extra` varchar(100) DEFAULT NULL,
  `mobile_extra` varchar(100) DEFAULT NULL,
  `comisionpagada` tinyint(1) DEFAULT '0',
  `fechapagocomision` date DEFAULT NULL,
  `valorplan` bigint(40) DEFAULT '0',
  `suscripcionid` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`contactid`),
  KEY `contactdetails_accountid_idx` (`parentid`),
  KEY `email_idx` (`email`),
  KEY `lastname` (`lastname`),
  KEY `vtiger_contactdetails_suscripcionid_idx` (`suscripcionid`),
  CONSTRAINT `fk_1_vtiger_contactdetails` FOREIGN KEY (`contactid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_convenio`;
CREATE TABLE `vtiger_convenio` (
  `convenioid` int(11) NOT NULL,
  `id_convenio` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `nro_caso` varchar(100) DEFAULT '',
  `rut` varchar(100) DEFAULT '',
  `direccion` varchar(100) DEFAULT '',
  `estadosus` varchar(255) DEFAULT '',
  `nroconvenio` varchar(50) DEFAULT '',
  `nombrecliente` varchar(100) DEFAULT '',
  `capital` bigint(50) DEFAULT '0',
  `interes` bigint(100) DEFAULT '0',
  `gastoscobranza` bigint(100) DEFAULT '0',
  `gastoconvenio` bigint(100) DEFAULT '0',
  `honorariosabogado` bigint(100) DEFAULT '0',
  `capital_convenio` bigint(100) DEFAULT '0',
  `interes_convenio` bigint(100) DEFAULT '0',
  `gastoscobranza_convenio` bigint(100) DEFAULT '0',
  `gastosconvenio_convenio` bigint(100) DEFAULT '0',
  `honorariosabogados_convenio` bigint(100) DEFAULT '0',
  `tipodenegociacion` varchar(255) DEFAULT '',
  `suscritopac` tinyint(1) DEFAULT '0',
  `totaldeudanegociar` bigint(100) DEFAULT '0',
  `fechaconvenio` date DEFAULT NULL,
  `totalconvenio1` bigint(100) DEFAULT '0',
  `abono_convenio` bigint(100) DEFAULT '0',
  `saldocapital` bigint(100) DEFAULT '0',
  `nrocuotas` varchar(255) DEFAULT '',
  `valorcuotas` bigint(100) DEFAULT '0',
  `diasvencimiento` varchar(100) DEFAULT '',
  `fechavencimientocuota1` date DEFAULT NULL,
  `interesconvenio` bigint(100) DEFAULT '0',
  `conveniofirmado` tinyint(1) DEFAULT '0',
  `abonorealizado` tinyint(1) DEFAULT '0',
  `abonoconfirmado` tinyint(1) DEFAULT '0',
  `sistemaregularizado` tinyint(1) DEFAULT '0',
  `eliminadosinacofi` tinyint(1) DEFAULT '0',
  `estadoconvenio` varchar(255) DEFAULT '',
  `concepto` varchar(255) DEFAULT '',
  `totalcapconvenio` bigint(100) DEFAULT '0',
  PRIMARY KEY (`convenioid`),
  CONSTRAINT `fk_1_vtiger_convenioconvenioid` FOREIGN KEY (`convenioid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_credito`;
CREATE TABLE `vtiger_credito` (
  `creditoid` int(11) NOT NULL DEFAULT '0',
  `credito` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `posibilidad` decimal(5,2) DEFAULT NULL,
  `viveencasa` varchar(255) DEFAULT '',
  `marca` varchar(255) DEFAULT '',
  `modelo` varchar(16) DEFAULT '',
  `nuevousado` varchar(255) DEFAULT '',
  `anio` varchar(255) DEFAULT '',
  `plazo` varchar(255) DEFAULT '',
  `acreditacionpie` varchar(255) DEFAULT '',
  `patente` varchar(16) DEFAULT '',
  `edocredito` varchar(255) DEFAULT '',
  `nreferencia1` varchar(32) DEFAULT '',
  `apellidoreferencia1` varchar(32) DEFAULT '',
  `fonoreferencia1` varchar(30) DEFAULT '',
  `fonoreferencia1_extra` varchar(100) DEFAULT NULL,
  `nreferencia2` varchar(32) DEFAULT '',
  `fonoreferencia2` varchar(30) DEFAULT '',
  `fonoreferencia2_extra` varchar(100) DEFAULT NULL,
  `parentezcoreferencia2` varchar(255) DEFAULT '',
  `apellidoreferencia2` varchar(32) DEFAULT '',
  `tipoempleado` varchar(255) DEFAULT '',
  `nempleador` varchar(32) DEFAULT '',
  `rutempleador` varchar(16) DEFAULT '',
  `direccionempleador` text,
  `fonoempleador` varchar(30) DEFAULT '',
  `fonoempleador_extra` varchar(100) DEFAULT NULL,
  `fingreso` date DEFAULT NULL,
  `dondeotrosingresos` text,
  `banco` varchar(255) DEFAULT '',
  `cuentacorriente` tinyint(1) DEFAULT '0',
  `antiguedad` varchar(255) DEFAULT '',
  `nombreconyugue` varchar(32) DEFAULT '',
  `apellidoconyugue` varchar(32) DEFAULT '',
  `actividad` varchar(32) DEFAULT '',
  `tipoempleadoconyugue` varchar(255) DEFAULT '',
  `movilconyugue` varchar(30) DEFAULT '',
  `movilconyugue_extra` varchar(100) DEFAULT NULL,
  `rutconyugue` varchar(16) DEFAULT '',
  `fingresoconyugue` date DEFAULT NULL,
  `nempleadorconyugue` varchar(32) DEFAULT '',
  `bieninmueble1` varchar(255) DEFAULT '',
  `dirbieninmueble1` text,
  `deudabieninmueble1` varchar(255) DEFAULT '',
  `bieninmueble2` varchar(255) DEFAULT '',
  `dirbieninmueble2` text,
  `deudainmueble2` varchar(255) DEFAULT '',
  `automovil1` varchar(255) DEFAULT '',
  `modeloauto1` varchar(32) DEFAULT '',
  `patenteauto1` varchar(16) DEFAULT '',
  `prendaauto1` varchar(255) DEFAULT '',
  `automovil2` varchar(255) DEFAULT '',
  `modeloauto2` varchar(32) DEFAULT '',
  `patenteauto2` varchar(16) DEFAULT '',
  `prendaauto2` varchar(255) DEFAULT '',
  `observacion` text,
  `parentezcoreferencia1` varchar(255) DEFAULT '',
  `observaciones` text,
  `entfinanciera1` varchar(255) DEFAULT '',
  `edoef1` varchar(255) DEFAULT '',
  `comunaempleador` varchar(255) DEFAULT '',
  `provinciaempleador` varchar(255) DEFAULT '',
  `comunabi1` varchar(255) DEFAULT '',
  `comunabi2` varchar(255) DEFAULT '',
  `provinciabi1` varchar(255) DEFAULT '',
  `regionbi1` varchar(255) DEFAULT '',
  `provinciabi2` varchar(255) DEFAULT '',
  `regionbi2` varchar(255) DEFAULT '',
  `valorvehiculo` bigint(64) DEFAULT '0',
  `montopie` bigint(64) DEFAULT '0',
  `rentaliquida` bigint(64) DEFAULT '0',
  `arriendobiener` bigint(64) DEFAULT '0',
  `pensionjubilacion` bigint(64) DEFAULT '0',
  `honorarios` bigint(64) DEFAULT '0',
  `otrosingresos` bigint(64) DEFAULT '0',
  `montolineacredito` bigint(64) DEFAULT '0',
  `totalingresos` bigint(64) DEFAULT '0',
  `sueldoconyugue` bigint(64) DEFAULT '0',
  `valorcomercialbi1` bigint(64) DEFAULT '0',
  `valorcomercialbi2` bigint(64) DEFAULT '0',
  `valorcomercialbm1` bigint(64) DEFAULT '0',
  `valorcomercialbm2` bigint(64) DEFAULT '0',
  `regionempleador` varchar(255) DEFAULT '',
  `cargo` varchar(64) DEFAULT '',
  `cargoconyugue` varchar(64) DEFAULT '',
  `nombrecliente` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`creditoid`),
  KEY `vtiger_credito_nombrecliente_idx` (`nombrecliente`),
  CONSTRAINT `fk_1_vtiger_creditocreditoid` FOREIGN KEY (`creditoid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacobertura`;
CREATE TABLE `vtiger_demandacobertura` (
  `demandacoberturaid` int(11) NOT NULL DEFAULT '0',
  `id` int(11) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `relsiniestro` int(11) unsigned DEFAULT '0',
  `siniestro` int(11) unsigned DEFAULT '0',
  `rut` varchar(15) DEFAULT '',
  `perddeterminadauf` decimal(10,2) DEFAULT NULL,
  `deducibleuf` decimal(8,2) DEFAULT NULL,
  `correo` varchar(25) DEFAULT '',
  `movil` varchar(15) DEFAULT '',
  `rol` varchar(25) DEFAULT '',
  `caratula` varchar(50) DEFAULT '',
  `perdreclamadauf` decimal(8,2) DEFAULT NULL,
  `valoruf` decimal(13,5) DEFAULT NULL,
  `perdindemnizableuff` decimal(8,2) DEFAULT NULL,
  `estdelcaso` varchar(30) DEFAULT '',
  `tribunalcompetente` varchar(255) DEFAULT '',
  `tribunalradicado` varchar(255) DEFAULT '',
  `estadodda` varchar(255) DEFAULT '',
  `bienesembargados` varchar(255) DEFAULT '',
  `cortecompetente` varchar(255) DEFAULT '',
  `rolrecursoqueja` varchar(30) DEFAULT '',
  `clasedeapelacion` varchar(255) DEFAULT '',
  `rolapelacion` varchar(30) DEFAULT '',
  `clasecasacion` varchar(255) DEFAULT '',
  `rolrecursocasacion` varchar(30) DEFAULT '',
  `rolrecursohecho` varchar(30) DEFAULT '',
  `formatoica` tinyint(1) DEFAULT '0',
  `generardda` tinyint(1) DEFAULT '0',
  `generarcumpleord` tinyint(1) DEFAULT '0',
  `generarart44` tinyint(1) DEFAULT '0',
  `generarformato` tinyint(1) DEFAULT '0',
  `generarautoprueba` tinyint(1) DEFAULT '0',
  `generaroirsentencia` tinyint(1) DEFAULT '0',
  `generarreposicion` tinyint(1) DEFAULT '0',
  `generarrepoyapela` tinyint(1) DEFAULT '0',
  `generarapela` tinyint(1) DEFAULT '0',
  `nombrereceptor` varchar(255) DEFAULT '',
  `comunacliente` varchar(255) DEFAULT '',
  `busquedanegativa` bigint(30) DEFAULT '0',
  `estadobusqueda` varchar(255) DEFAULT '',
  `not44` bigint(30) DEFAULT '0',
  `estadonot44` varchar(255) DEFAULT '',
  `notporcedula` bigint(30) DEFAULT '0',
  `estadonotcedula` varchar(255) DEFAULT '',
  `notificacionpersonal` bigint(30) DEFAULT '0',
  `estadonotpersonal` varchar(255) DEFAULT '',
  `embargo` bigint(30) DEFAULT '0',
  `estadoembargo` varchar(255) DEFAULT '',
  `preciobusqueda` bigint(30) DEFAULT '0',
  `precionotcedula` bigint(30) DEFAULT '0',
  `precionot44` bigint(30) DEFAULT '0',
  `precioembargo` bigint(30) DEFAULT '0',
  `precionotpersonal` bigint(30) DEFAULT '0',
  `totalapagar` bigint(30) DEFAULT '0',
  `pagar` tinyint(1) DEFAULT '0',
  `pagohistorico` bigint(30) DEFAULT '0',
  `informativoddapresentada` tinyint(1) DEFAULT '0',
  `fechainfddapresentada` date DEFAULT NULL,
  `ddapresentada` tinyint(1) DEFAULT '0',
  `fechaddapresentada` date DEFAULT NULL,
  `cert_pjudenv` tinyint(1) DEFAULT '0',
  `fech_envcertpjud` date DEFAULT NULL,
  `comuna` varchar(255) DEFAULT '',
  `idclientevd1` int(11) unsigned DEFAULT '0',
  `ddo` varchar(255) DEFAULT '',
  `rutcomp` varchar(255) DEFAULT '',
  `gestionespendientes` tinyint(1) DEFAULT '0',
  `tarea` text,
  `fechaaudcon` date DEFAULT NULL,
  `edocaupru` varchar(255) DEFAULT '',
  `fechanotcausapru` date DEFAULT NULL,
  `notext` tinyint(1) DEFAULT '0',
  `informativoddaprove` tinyint(1) DEFAULT '0',
  `informativoaud` tinyint(1) DEFAULT '0',
  `informativocausaprueba` tinyint(1) DEFAULT '0',
  `actualizar` tinyint(1) DEFAULT '0',
  `tribunal` varchar(255) DEFAULT '',
  `audcon` varchar(255) DEFAULT '',
  `cumpinc` tinyint(1) DEFAULT '0',
  `abogadoasignado` varchar(255) DEFAULT '',
  `mesasignacion` varchar(255) DEFAULT '',
  `tipo_demanda` varchar(255) DEFAULT '',
  `obs_llamada` text,
  `fechallama` date DEFAULT NULL,
  `tiposervicio` varchar(255) DEFAULT '',
  PRIMARY KEY (`demandacoberturaid`),
  KEY `vtiger_demandacobertura_relsiniestro_idx` (`relsiniestro`),
  KEY `vtiger_demandacobertura_siniestro_idx` (`siniestro`),
  KEY `vtiger_demandacobertura_idclientevd1_idx` (`idclientevd1`),
  CONSTRAINT `fk_1_vtiger_demandacoberturademandacoberturaid` FOREIGN KEY (`demandacoberturaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacobranzaclientes`;
CREATE TABLE `vtiger_demandacobranzaclientes` (
  `demandacobranzaclientesid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `correo` varchar(25) DEFAULT '',
  `direcnot` varchar(50) DEFAULT '',
  `montofact` bigint(20) DEFAULT '0',
  `indem` bigint(15) DEFAULT '0',
  `telefono` varchar(15) DEFAULT '',
  `rol` varchar(30) DEFAULT '',
  `caratula` varchar(40) DEFAULT '',
  `estadodda` varchar(255) DEFAULT '',
  `tribunalcompetente` varchar(255) DEFAULT '',
  `tribunalradicado` varchar(255) DEFAULT '',
  `generarformato` tinyint(1) DEFAULT '0',
  `genart44` tinyint(1) DEFAULT '0',
  `generargestprep` tinyint(1) DEFAULT '0',
  `generarcumpleord` tinyint(1) DEFAULT '0',
  `generarautoprueba` tinyint(1) DEFAULT '0',
  `generaroirsentencia` tinyint(1) DEFAULT '0',
  `generarreposicion` tinyint(1) DEFAULT '0',
  `generarrepoyapela` tinyint(1) DEFAULT '0',
  `generarapela` tinyint(1) DEFAULT '0',
  `estadocobranza` varchar(30) DEFAULT '',
  `ciudadnotificacion` varchar(30) DEFAULT '',
  `comuna` varchar(255) DEFAULT '',
  `actualizar` tinyint(1) DEFAULT '0',
  `nrocaso` int(11) unsigned DEFAULT '0',
  `rut` varchar(14) DEFAULT '',
  `generarddasinoposi` tinyint(1) DEFAULT '0',
  `generarddaconoposi` tinyint(1) DEFAULT '0',
  `preciobusquedas` bigint(15) DEFAULT '0',
  `precionotcedula` bigint(15) DEFAULT '0',
  `precionotpersonal` bigint(15) DEFAULT '0',
  `totaldeudasuscrip` bigint(15) DEFAULT '0',
  `totaldeudaasesoria` bigint(15) DEFAULT '0',
  `deudatotal` bigint(15) DEFAULT '0',
  `nrofacturasuscripcion` varchar(15) DEFAULT '',
  `fechafacturasus` date DEFAULT NULL,
  `fechavencimientofacturasus` date DEFAULT NULL,
  `nrofacturaasesoria` varchar(15) DEFAULT '',
  `fechafacturaasesoria` date DEFAULT NULL,
  `fechavencimientofacturaaseso` date DEFAULT NULL,
  `demandado` int(11) unsigned DEFAULT '0',
  `busquedanegativa` bigint(15) DEFAULT '0',
  `not44` bigint(15) DEFAULT '0',
  `notporcedula` bigint(15) DEFAULT '0',
  `notpersonal` bigint(15) DEFAULT '0',
  `precionot44` bigint(15) DEFAULT '0',
  `totalapagar` bigint(15) DEFAULT '0',
  `comunacliente` varchar(255) DEFAULT '',
  `relacioncobranza` int(11) NOT NULL,
  `idcobranzas` bigint(11) DEFAULT '0',
  `estadobusqueda` varchar(255) DEFAULT '',
  `estadonot44` varchar(255) DEFAULT '',
  `estadonotcedula` varchar(255) DEFAULT '',
  `estadonotpersonal` varchar(255) DEFAULT '',
  `pagar` tinyint(1) DEFAULT '0',
  `pagohistorico` bigint(20) DEFAULT '0',
  `bienesembargados` text,
  `precioembargo` bigint(20) DEFAULT '0',
  `estadoembargo` varchar(255) DEFAULT '',
  `nombrereceptord` varchar(255) DEFAULT '',
  `embargo` bigint(20) DEFAULT '0',
  `cortecompetente` varchar(255) DEFAULT '',
  `rolrecursohecho` varchar(45) DEFAULT '',
  `rolrecursoqueja` varchar(45) DEFAULT '',
  `clasecasacion` varchar(255) DEFAULT '',
  `rolrecursocasacion` varchar(45) DEFAULT '',
  `rolapelacion` varchar(45) DEFAULT '',
  `claseapelacion` varchar(255) DEFAULT '',
  `formatoica` tinyint(1) DEFAULT '0',
  `generargestprepsusas` tinyint(1) DEFAULT '0',
  `ddasinopsusas` tinyint(1) DEFAULT '0',
  `ddaconopsussas` tinyint(1) DEFAULT '0',
  `divisionempresa` varchar(255) DEFAULT '',
  `tipddacob` varchar(255) DEFAULT '',
  `etapacobam` varchar(255) DEFAULT '',
  `gabogados` tinyint(1) DEFAULT '0',
  `montogabogados` bigint(100) DEFAULT '0',
  `protesto` tinyint(1) DEFAULT '0',
  `mprotesto` bigint(100) DEFAULT '0',
  `cantidadnotenc` varchar(255) DEFAULT '',
  `valornot` bigint(100) DEFAULT '0',
  `montonot` bigint(100) DEFAULT '0',
  `correopreuno` tinyint(1) DEFAULT '0',
  `correopredos` tinyint(1) DEFAULT '0',
  `correopretres` tinyint(1) DEFAULT '0',
  `correojudicialunouno` tinyint(1) DEFAULT '0',
  `correojudicialunodos` tinyint(1) DEFAULT '0',
  `correojudicialtres` tinyint(1) DEFAULT '0',
  `correojudicialdosuno` tinyint(1) DEFAULT '0',
  `correojudicialdosdos` tinyint(1) DEFAULT '0',
  `correojudicialdostres` tinyint(1) DEFAULT '0',
  `gadmin` tinyint(1) DEFAULT '0',
  `montogadministrativos` bigint(100) DEFAULT '0',
  `fechanotdda` date DEFAULT NULL,
  `fechaaudprep` date DEFAULT NULL,
  `fechaaudcon` date DEFAULT NULL,
  `fechainiterpro` date DEFAULT NULL,
  `fechasentdef` date DEFAULT NULL,
  `valorplan` bigint(100) DEFAULT '0',
  `fechainicioetapados` date DEFAULT NULL,
  `fechainicioetapauno` date DEFAULT NULL,
  `fechainicioetapatres` date DEFAULT NULL,
  `valorplansus` bigint(100) DEFAULT '0',
  `valorabonosus` bigint(100) DEFAULT '0',
  `valorcuotaunosus` bigint(100) DEFAULT '0',
  `valorcuotadossus` bigint(100) DEFAULT '0',
  `abonopagadosus` tinyint(1) DEFAULT '0',
  `cuotaunopagadasus` tinyint(1) DEFAULT '0',
  `cuotadospagadasus` tinyint(1) DEFAULT '0',
  `estadopagohonorarios` varchar(255) DEFAULT '',
  `facturapagadasus` tinyint(1) DEFAULT '0',
  `facturapagadahon` tinyint(1) DEFAULT '0',
  `reajusteinteres` tinyint(1) DEFAULT '0',
  `montoreajusteinteres` bigint(100) DEFAULT '0',
  `montodeudatotal` bigint(100) DEFAULT '0',
  `obs` text,
  PRIMARY KEY (`demandacobranzaclientesid`),
  KEY `vtiger_demandacobranzaclientes_nrocaso_idx` (`nrocaso`),
  KEY `vtiger_demandacobranzaclientes_demandado_idx` (`demandado`),
  CONSTRAINT `fk_1_vtiger_demandacobranzaclientesdemandacobranzaclientesid` FOREIGN KEY (`demandacobranzaclientesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacolectiva`;
CREATE TABLE `vtiger_demandacolectiva` (
  `demandacolectivaid` int(11) NOT NULL,
  `demandacolectiva` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `idcliente` int(11) unsigned DEFAULT '0',
  `idsiniestro` int(11) unsigned DEFAULT '0',
  `movil` varchar(20) DEFAULT '',
  `email` varchar(30) DEFAULT '',
  `contratofirmado` tinyint(1) DEFAULT '0',
  `descargadoc` varchar(255) DEFAULT '',
  `fcontratofirmado` date DEFAULT NULL,
  PRIMARY KEY (`demandacolectivaid`),
  KEY `vtiger_demandacolectiva_idcliente_idx` (`idcliente`),
  KEY `vtiger_demandacolectiva_idsiniestro_idx` (`idsiniestro`),
  CONSTRAINT `fk_1_vtiger_demandacolectivademandacolectivaid` FOREIGN KEY (`demandacolectivaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacomercial`;
CREATE TABLE `vtiger_demandacomercial` (
  `demandacomercialid` int(11) NOT NULL DEFAULT '0',
  `id` int(11) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `siniestro` int(11) unsigned DEFAULT '0',
  `inf_dda_presentada` tinyint(1) DEFAULT '0',
  `fecha_inf_dda_presentada` date DEFAULT NULL,
  `cert_pjudenv` tinyint(1) DEFAULT '0',
  `fech_envcertpjud` date DEFAULT NULL,
  `rol` varchar(15) DEFAULT '',
  `caratula` varchar(150) DEFAULT '',
  `dda_presentada` tinyint(1) DEFAULT '0',
  `fech_dda_presentada` varchar(50) DEFAULT NULL,
  `rut` varchar(15) DEFAULT '',
  `relgestcom` int(11) unsigned DEFAULT '0',
  `tribunalcompetente` varchar(255) DEFAULT '',
  `tribunalradicado` varchar(255) DEFAULT '',
  `estadodda` varchar(255) DEFAULT '',
  `bienesembargados` varchar(255) DEFAULT '',
  `cortecompetente` varchar(255) DEFAULT '',
  `rolrecursoqueja` varchar(30) DEFAULT '',
  `clasedeapelacion` varchar(255) DEFAULT '',
  `rolapelacion` varchar(30) DEFAULT '',
  `clasecasacion` varchar(255) DEFAULT '',
  `rolrecursocasacion` varchar(20) DEFAULT '',
  `rolrecursohecho` varchar(30) DEFAULT '',
  `generardda` tinyint(1) DEFAULT '0',
  `generarcumpleord` tinyint(1) DEFAULT '0',
  `genart44` tinyint(1) DEFAULT '0',
  `generarformato` tinyint(1) DEFAULT '0',
  `generarautoprueba` tinyint(1) DEFAULT '0',
  `generaroirsentencia` tinyint(1) DEFAULT '0',
  `generarreposicion` tinyint(1) DEFAULT '0',
  `generarrepoyapela` tinyint(1) DEFAULT '0',
  `generarapela` tinyint(1) DEFAULT '0',
  `formatoica` tinyint(1) DEFAULT '0',
  `relacionventaddas` int(11) unsigned DEFAULT '0',
  `nombrereceptor` varchar(255) DEFAULT '',
  `busquedanegativa` bigint(30) DEFAULT '0',
  `estadobusqueda` varchar(255) DEFAULT '',
  `not44` bigint(30) DEFAULT '0',
  `estadonot44` varchar(255) DEFAULT '',
  `notporcedula` bigint(30) DEFAULT '0',
  `estadonotcedula` varchar(255) DEFAULT '',
  `notpersonal` bigint(30) DEFAULT '0',
  `estadonotpersonal` varchar(255) DEFAULT '',
  `embargo` bigint(30) DEFAULT '0',
  `estadoembargo` varchar(255) DEFAULT '',
  `preciobusqueda` bigint(30) DEFAULT '0',
  `precionotcedula` bigint(30) DEFAULT '0',
  `precionot44` bigint(30) DEFAULT '0',
  `precioembargo` bigint(30) DEFAULT '0',
  `precionotpersonal` bigint(30) DEFAULT '0',
  `totalapagar` bigint(30) DEFAULT '0',
  `pagar` tinyint(1) DEFAULT '0',
  `pagohistorico` bigint(30) DEFAULT '0',
  `comunacliente` varchar(255) DEFAULT '',
  `comuna` varchar(255) DEFAULT '',
  `demandadoid` int(11) unsigned DEFAULT '0',
  `correo` varchar(100) DEFAULT '',
  `movil` varchar(50) DEFAULT '',
  `ddo` varchar(255) DEFAULT '',
  `rutcomp` varchar(255) DEFAULT '',
  `tribunalradica` varchar(100) DEFAULT '',
  `gestionespendientes` tinyint(1) DEFAULT '0',
  `tarea` text,
  `actualizar` tinyint(1) DEFAULT '0',
  `ventadedemandasid` int(11) unsigned DEFAULT '0',
  `fechacuotaunopagada` date DEFAULT NULL,
  `tribunal` varchar(255) DEFAULT '',
  `abogadoasignado` varchar(255) DEFAULT '',
  `mesasignacion` varchar(255) DEFAULT '',
  `suscripcionddaid` int(11) unsigned DEFAULT '0',
  `tiposervicio` varchar(255) DEFAULT '',
  PRIMARY KEY (`demandacomercialid`),
  KEY `vtiger_demandacomercial_siniestro_idx` (`siniestro`),
  KEY `vtiger_demandacomercial_relgestcom_idx` (`relgestcom`),
  KEY `vtiger_demandacomercial_relacionventaddas_idx` (`relacionventaddas`),
  KEY `vtiger_demandacomercial_demandadoid_idx` (`demandadoid`),
  KEY `vtiger_demandacomercial_ventadedemandasid_idx` (`ventadedemandasid`),
  KEY `vtiger_demandacomercial_suscripcionddaid_idx` (`suscripcionddaid`),
  CONSTRAINT `fk_1_vtiger_demandacomercialdemandacomercialid` FOREIGN KEY (`demandacomercialid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_detallecobrosypagos`;
CREATE TABLE `vtiger_detallecobrosypagos` (
  `detallecobrosypagosid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `concepto` varchar(100) DEFAULT '',
  `monto` decimal(16,8) DEFAULT NULL,
  `sinisestroid` int(11) unsigned DEFAULT '0',
  `clienteid` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`detallecobrosypagosid`),
  KEY `vtiger_detallecobrosypagos_sinisestroid_idx` (`sinisestroid`),
  KEY `vtiger_detallecobrosypagos_clienteid_idx` (`clienteid`),
  CONSTRAINT `fk_1_vtiger_detallecobrosypagosdetallecobrosypagosid` FOREIGN KEY (`detallecobrosypagosid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_entity_stats`;
CREATE TABLE `vtiger_entity_stats` (
  `crmid` int(10) NOT NULL,
  `crmactivity` smallint(5) DEFAULT NULL,
  PRIMARY KEY (`crmid`),
  CONSTRAINT `fk_1_vtiger_entity_stats` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_faq`;
CREATE TABLE `vtiger_faq` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `faq_no` varchar(100) NOT NULL,
  `product_id` varchar(100) DEFAULT NULL,
  `question` text,
  `answer` text,
  `category` varchar(200) NOT NULL,
  `status` varchar(200) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `faq_id_idx` (`id`),
  CONSTRAINT `fk_1_vtiger_faq` FOREIGN KEY (`id`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_gestcomdda`;
CREATE TABLE `vtiger_gestcomdda` (
  `gestcomddaid` int(11) NOT NULL DEFAULT '0',
  `gestcomdda` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `nombre` varchar(59) DEFAULT '',
  `apellido` varchar(59) DEFAULT '',
  `cliente` varchar(59) DEFAULT '',
  `serienrodocto` varchar(59) DEFAULT '',
  `movil` varchar(30) DEFAULT '',
  `movil_extra` varchar(100) DEFAULT NULL,
  `tlfparticular` varchar(30) DEFAULT '',
  `tlfparticular_extra` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT '',
  `observaciones` text,
  `edogestion` varchar(255) DEFAULT '',
  `llamada` varchar(255) DEFAULT '',
  `direccionsiniestro` text,
  `categorizacion` varchar(255) DEFAULT '',
  `perdidaindemnizable` decimal(62,2) DEFAULT NULL,
  `deducibleafecto` decimal(62,2) DEFAULT NULL,
  `perdidadeterminada` decimal(62,2) DEFAULT NULL,
  `pagoporcentaje` decimal(5,2) DEFAULT NULL,
  `fdenuncio` date DEFAULT NULL,
  `fvisita` date DEFAULT NULL,
  `fpresupuesto` date DEFAULT NULL,
  `frecinfliq` date DEFAULT NULL,
  `fimpugnacion` date DEFAULT NULL,
  `frespimpugnacion` date DEFAULT NULL,
  `fultgestion` date DEFAULT NULL,
  `notificacionemail` tinyint(1) DEFAULT '0',
  `notificacionrechazo` tinyint(1) DEFAULT '0',
  `notificacionaceptacion` tinyint(1) DEFAULT '0',
  `tlfotro` varchar(30) DEFAULT '',
  `tlfotro_extra` varchar(100) DEFAULT NULL,
  `mailotro` varchar(100) DEFAULT '',
  `siniestro` int(11) unsigned DEFAULT '0',
  `valor1cuota` bigint(59) DEFAULT '0',
  `valor2cuota` bigint(59) DEFAULT '0',
  `valor3cuota` bigint(59) DEFAULT '0',
  `1cuotapagada` tinyint(1) DEFAULT '0',
  `2cuotapagada` tinyint(1) DEFAULT '0',
  `3cuotapagada` tinyint(1) DEFAULT '0',
  `f1cuota` date DEFAULT NULL,
  `f2cuota` date DEFAULT NULL,
  `f3cuota` date DEFAULT NULL,
  `tiposiniestro` varchar(16) DEFAULT '',
  `comunacaso` varchar(16) DEFAULT '',
  `ciaseguros` varchar(16) DEFAULT '',
  `banco` varchar(32) DEFAULT '',
  `entliquidadora` varchar(32) DEFAULT '',
  `estado` varchar(32) DEFAULT '',
  `fsismo` varchar(32) DEFAULT '',
  `fvolverllamar` date DEFAULT NULL,
  `hvolverllamar` varchar(255) DEFAULT '',
  `obsllamada` text,
  `volverllamar` tinyint(1) DEFAULT '0',
  `modificardatos` tinyint(1) DEFAULT '0',
  `comentariomodificacion` text,
  `fcompromisocuota1` date DEFAULT NULL,
  `fcompromisocuota2` date DEFAULT NULL,
  `fcompromisocuota3` date DEFAULT NULL,
  `montopresupuesto` bigint(64) DEFAULT '0',
  `perdidadeterminadap` bigint(64) DEFAULT '0',
  `deducibleafectop` bigint(64) DEFAULT '0',
  `perdidaindemnizablep` bigint(64) DEFAULT '0',
  `dctosfirmados` tinyint(1) DEFAULT '0',
  `fcontratofirmado` date DEFAULT NULL,
  `comentariocontrato` text,
  `dctosdec` tinyint(1) DEFAULT '0',
  `montoporreclamarp` bigint(64) DEFAULT '0',
  `perdidareclamada` bigint(64) DEFAULT '0',
  `casorevisado` tinyint(1) DEFAULT '0',
  `costodemanda` bigint(32) DEFAULT '0',
  `abono` bigint(59) DEFAULT '0',
  `valorcuota` bigint(59) DEFAULT '0',
  `diapago` varchar(255) DEFAULT '',
  `fprimerpago` date DEFAULT NULL,
  `deudarestante` bigint(59) DEFAULT '0',
  `ciudadcaso` varchar(32) DEFAULT '',
  `nombrecliente` int(11) unsigned DEFAULT '0',
  `edocivil` varchar(255) DEFAULT '',
  `profesion` varchar(59) DEFAULT '',
  `abonopagado` tinyint(1) DEFAULT '0',
  `fabono` date DEFAULT NULL,
  `tpagoabono` varchar(255) DEFAULT '',
  `bdpago` varchar(255) DEFAULT '',
  `nrocuotasgd` varchar(255) DEFAULT '',
  `tpago1cuota` varchar(255) DEFAULT '',
  `tpago2cuota` varchar(255) DEFAULT '',
  `tpago3cuota` varchar(255) DEFAULT '',
  `bdpago1cuota` varchar(255) DEFAULT '',
  `bdpago3cuota` varchar(255) DEFAULT '',
  `bdpago2cuota` varchar(255) DEFAULT '',
  `fpagoabono` date DEFAULT NULL,
  `nfacabono` bigint(59) DEFAULT '0',
  `mailinformativo` tinyint(1) DEFAULT '0',
  `fabono0` date DEFAULT NULL,
  `nrofactura` bigint(59) DEFAULT '0',
  `ffactura` date DEFAULT NULL,
  `ffacturapagada` date DEFAULT NULL,
  `facturapagada` tinyint(1) DEFAULT '0',
  `fnegociacion` date DEFAULT NULL,
  `fdocdec` date DEFAULT NULL,
  `result` text,
  `presupuestomanual` tinyint(1) DEFAULT '0',
  `descmand` tinyint(1) DEFAULT '0',
  `mandatofirmado` tinyint(1) DEFAULT '0',
  `fmandatofirmado` date DEFAULT NULL,
  `codwebpayabono` bigint(12) DEFAULT '0',
  `codwebpaycuota1` bigint(12) DEFAULT '0',
  `codwebpaycuota2` bigint(12) DEFAULT '0',
  `codwebpaycuota3` bigint(12) DEFAULT '0',
  `tarjpagoabono` varchar(255) DEFAULT '',
  `tarjpagocuota1` varchar(255) DEFAULT '',
  `tarjpagocuota2` varchar(255) DEFAULT '',
  `tarjpagocuota3` varchar(255) DEFAULT '',
  `carta_demanda` tinyint(1) DEFAULT '0',
  `mail_firmas` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`gestcomddaid`),
  KEY `vtiger_gestcomdda_siniestro_idx` (`siniestro`),
  KEY `vtiger_gestcomdda_nombrecliente_idx` (`nombrecliente`),
  CONSTRAINT `fk_1_vtiger_gestcomddagestcomddaid` FOREIGN KEY (`gestcomddaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_gestionllamada`;
CREATE TABLE `vtiger_gestionllamada` (
  `gestionllamadaid` int(11) NOT NULL DEFAULT '0',
  `telefono` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `llamada` varchar(255) DEFAULT '',
  `volverllamar` tinyint(1) DEFAULT '0',
  `edoasesoria` varchar(255) DEFAULT '',
  `fvolverllamar` date DEFAULT NULL,
  `hvolverllamar` varchar(255) DEFAULT '',
  `obsllamada` text,
  `nombres` varchar(59) DEFAULT '',
  `apellidos` varchar(59) DEFAULT '',
  `rut` varchar(16) DEFAULT '',
  `serienrodocto` varchar(16) DEFAULT '',
  `email` varchar(100) DEFAULT '',
  `otrotlf` varchar(30) DEFAULT '',
  `otrotlf_extra` varchar(100) DEFAULT NULL,
  `otroemail` varchar(100) DEFAULT '',
  `profesion` varchar(59) DEFAULT '',
  `edocivil` varchar(255) DEFAULT '',
  `obscliente` text,
  `quienrefirio` int(11) unsigned DEFAULT '0',
  `comunadelcliente` varchar(255) DEFAULT '',
  `provinciadelcliente` varchar(255) DEFAULT '',
  `regiondelcliente` varchar(255) DEFAULT '',
  `direccioncaso` text,
  `direccioncliente` text,
  `comunadelcaso` varchar(255) DEFAULT '',
  `provinciadelcaso` varchar(255) DEFAULT '',
  `regiondelcaso` varchar(255) DEFAULT '',
  `nacionalidad` varchar(255) DEFAULT '',
  `provienede` varchar(255) DEFAULT '',
  `telefono2` varchar(24) DEFAULT '',
  `telefono3` varchar(24) DEFAULT '',
  `fnacimiento` date DEFAULT NULL,
  `renta` bigint(24) DEFAULT '0',
  `tiposiniestro` varchar(255) DEFAULT '',
  `tipopropiedad` varchar(255) DEFAULT '',
  `banco` varchar(255) DEFAULT '',
  `ciaseguros` varchar(255) DEFAULT '',
  `mts2` decimal(27,2) DEFAULT NULL,
  `valoruf` bigint(12) DEFAULT '0',
  `diapago` varchar(255) DEFAULT '',
  `nrocaso` varchar(24) DEFAULT '',
  `valorplan` varchar(255) DEFAULT '',
  `metodopago` varchar(255) DEFAULT '',
  `motivorechazo` varchar(255) DEFAULT '',
  `otromotivo` text,
  `enviocorreopres` tinyint(1) DEFAULT '0',
  `fenviocorreopres` date DEFAULT NULL,
  `eliminarbd` tinyint(1) DEFAULT '0',
  `cantllamados` varchar(255) DEFAULT '',
  `resultgestion` varchar(255) DEFAULT '',
  PRIMARY KEY (`gestionllamadaid`),
  KEY `vtiger_gestionllamada_quienrefirio_idx` (`quienrefirio`),
  CONSTRAINT `fk_1_vtiger_gestionllamadagestionllamadaid` FOREIGN KEY (`gestionllamadaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_gestionrrss`;
CREATE TABLE `vtiger_gestionrrss` (
  `gestionrrssid` int(11) NOT NULL DEFAULT '0',
  `nickname` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `fcontacto` date DEFAULT NULL,
  `canal` varchar(255) DEFAULT '',
  `edocontacto` varchar(255) DEFAULT '',
  `edocaso` varchar(255) DEFAULT '',
  `motivorechazo` varchar(255) DEFAULT '',
  `otro` varchar(24) DEFAULT '',
  `obscontacto` text,
  `obscaso` text,
  `movil` varchar(30) DEFAULT '',
  `movil_extra` varchar(100) DEFAULT NULL,
  `otrotlf` varchar(30) DEFAULT '',
  `otrotlf_extra` varchar(100) DEFAULT NULL,
  `nombres` varchar(24) DEFAULT '',
  `apellidos` varchar(24) DEFAULT '',
  `banco` varchar(255) DEFAULT '',
  `obsventa` text,
  `comunadelcaso` varchar(255) DEFAULT '',
  `provinciadelcaso` varchar(255) DEFAULT '',
  PRIMARY KEY (`gestionrrssid`),
  CONSTRAINT `fk_1_vtiger_gestionrrssgestionrrssid` FOREIGN KEY (`gestionrrssid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_holidaysentitlement`;
CREATE TABLE `vtiger_holidaysentitlement` (
  `holidaysentitlementid` int(10) NOT NULL DEFAULT '0',
  `holidaysentitlement_no` varchar(255) DEFAULT NULL,
  `holidaysentitlement_year` varchar(50) DEFAULT NULL,
  `days` int(3) DEFAULT '0',
  `ossemployeesid` int(10) DEFAULT NULL,
  PRIMARY KEY (`holidaysentitlementid`),
  KEY `ossemployeesid` (`ossemployeesid`),
  CONSTRAINT `fk_1_vtiger_holidaysentitlement` FOREIGN KEY (`holidaysentitlementid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ideas`;
CREATE TABLE `vtiger_ideas` (
  `ideasid` int(10) NOT NULL DEFAULT '0',
  `ideas_no` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `ideasstatus` varchar(255) DEFAULT '',
  `extent_description` text,
  PRIMARY KEY (`ideasid`),
  CONSTRAINT `fk_1_vtiger_ideas` FOREIGN KEY (`ideasid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_leaddetails`;
CREATE TABLE `vtiger_leaddetails` (
  `leadid` int(10) NOT NULL,
  `lead_no` varchar(100) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `interest` varchar(50) DEFAULT NULL,
  `firstname` varchar(40) DEFAULT NULL,
  `salutation` varchar(200) DEFAULT NULL,
  `lastname` varchar(80) DEFAULT NULL,
  `company` varchar(100) NOT NULL,
  `annualrevenue` decimal(25,8) DEFAULT NULL,
  `industry` varchar(200) DEFAULT NULL,
  `campaign` varchar(30) DEFAULT NULL,
  `leadstatus` varchar(50) DEFAULT NULL,
  `leadsource` varchar(200) DEFAULT NULL,
  `converted` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `licencekeystatus` varchar(50) DEFAULT NULL,
  `space` varchar(250) DEFAULT NULL,
  `comments` text,
  `priority` varchar(50) DEFAULT NULL,
  `demorequest` varchar(50) DEFAULT NULL,
  `partnercontact` varchar(50) DEFAULT NULL,
  `productversion` varchar(20) DEFAULT NULL,
  `product` varchar(50) DEFAULT NULL,
  `maildate` date DEFAULT NULL,
  `nextstepdate` date DEFAULT NULL,
  `fundingsituation` varchar(50) DEFAULT NULL,
  `purpose` varchar(50) DEFAULT NULL,
  `evaluationstatus` varchar(50) DEFAULT NULL,
  `transferdate` date DEFAULT NULL,
  `revenuetype` varchar(50) DEFAULT NULL,
  `noofemployees` int(50) DEFAULT NULL,
  `secondaryemail` varchar(100) DEFAULT NULL,
  `assignleadchk` int(1) DEFAULT '0',
  `noapprovalcalls` smallint(1) DEFAULT NULL,
  `noapprovalemails` smallint(1) DEFAULT NULL,
  `vat_id` varchar(30) DEFAULT NULL,
  `registration_number_1` varchar(30) DEFAULT NULL,
  `registration_number_2` varchar(30) DEFAULT NULL,
  `verification` text,
  `subindustry` varchar(255) DEFAULT '',
  `atenttion` text,
  `leads_relation` varchar(255) DEFAULT NULL,
  `legal_form` varchar(255) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `active` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`leadid`),
  KEY `leaddetails_converted_leadstatus_idx` (`converted`,`leadstatus`),
  KEY `email_idx` (`email`),
  KEY `lastname` (`lastname`),
  KEY `converted` (`converted`),
  CONSTRAINT `fk_1_vtiger_leaddetails` FOREIGN KEY (`leadid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_lettersin`;
CREATE TABLE `vtiger_lettersin` (
  `lettersinid` int(10) NOT NULL DEFAULT '0',
  `number` varchar(255) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `relatedid` int(10) DEFAULT NULL,
  `person_receiving` int(10) DEFAULT NULL,
  `parentid` int(10) DEFAULT NULL,
  `date_adoption` date DEFAULT NULL,
  `lin_type_ship` varchar(255) DEFAULT '',
  `lin_type_doc` text,
  `lin_status` varchar(255) DEFAULT '',
  `deadline_reply` date DEFAULT NULL,
  `cocument_no` varchar(100) DEFAULT '',
  `no_internal` varchar(100) DEFAULT '',
  `lin_dimensions` varchar(255) DEFAULT '',
  `custom_sender` varchar(255) DEFAULT NULL,
  `lin_type` varchar(255) DEFAULT NULL,
  `cash_amount_on_delivery` decimal(25,8) DEFAULT NULL,
  `date_of_receipt` date DEFAULT NULL,
  `outgoing_correspondence` int(10) DEFAULT NULL,
  PRIMARY KEY (`lettersinid`),
  KEY `vtiger_lettersin_outgoing_correspondence_idx` (`outgoing_correspondence`),
  CONSTRAINT `fk_1_vtiger_lettersin` FOREIGN KEY (`lettersinid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_lettersout`;
CREATE TABLE `vtiger_lettersout` (
  `lettersoutid` int(10) NOT NULL DEFAULT '0',
  `number` varchar(255) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `relatedid` int(10) DEFAULT NULL,
  `person_receiving` int(10) DEFAULT NULL,
  `parentid` int(10) DEFAULT NULL,
  `date_adoption` date DEFAULT NULL,
  `lout_type_ship` varchar(255) DEFAULT '',
  `lout_type_doc` text,
  `lout_status` varchar(255) DEFAULT '',
  `deadline_reply` date DEFAULT NULL,
  `cocument_no` varchar(100) DEFAULT '',
  `no_internal` varchar(100) DEFAULT '',
  `lout_dimensions` varchar(255) DEFAULT '',
  `incoming_correspondence` int(10) DEFAULT NULL,
  PRIMARY KEY (`lettersoutid`),
  KEY `vtiger_lettersout_incoming_correspondence_idx` (`incoming_correspondence`),
  CONSTRAINT `fk_1_vtiger_lettersout` FOREIGN KEY (`lettersoutid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_modcomments`;
CREATE TABLE `vtiger_modcomments` (
  `modcommentsid` int(10) NOT NULL,
  `commentcontent` text,
  `related_to` int(10) DEFAULT NULL,
  `parent_comments` int(10) DEFAULT NULL,
  `customer` varchar(100) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL,
  `reasontoedit` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`modcommentsid`),
  KEY `relatedto_idx` (`related_to`),
  KEY `modcommentsid` (`modcommentsid`),
  KEY `parent_comments` (`parent_comments`),
  KEY `userid` (`userid`),
  KEY `related_to` (`related_to`,`parent_comments`),
  CONSTRAINT `vtiger_modcomments_ibfk_1` FOREIGN KEY (`related_to`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_notes`;
CREATE TABLE `vtiger_notes` (
  `notesid` int(10) NOT NULL DEFAULT '0',
  `note_no` varchar(100) NOT NULL,
  `title` varchar(200) NOT NULL,
  `filename` varchar(200) DEFAULT NULL,
  `notecontent` text,
  `folderid` varchar(255) DEFAULT NULL,
  `filetype` varchar(100) DEFAULT NULL,
  `filelocationtype` varchar(5) DEFAULT NULL,
  `filedownloadcount` int(10) DEFAULT NULL,
  `filestatus` smallint(1) DEFAULT NULL,
  `filesize` int(10) NOT NULL DEFAULT '0',
  `fileversion` varchar(50) DEFAULT NULL,
  `ossdc_status` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`notesid`),
  KEY `notes_title_idx` (`title`),
  KEY `notes_notesid_idx` (`notesid`),
  CONSTRAINT `fk_1_vtiger_notes` FOREIGN KEY (`notesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossemployees`;
CREATE TABLE `vtiger_ossemployees` (
  `ossemployeesid` int(10) NOT NULL DEFAULT '0',
  `ossemployees_no` varchar(255) DEFAULT NULL,
  `parentid` int(10) DEFAULT '0',
  `employee_status` varchar(200) DEFAULT NULL,
  `name` varchar(200) DEFAULT NULL,
  `last_name` varchar(200) DEFAULT NULL,
  `pesel` varchar(20) DEFAULT NULL,
  `id_card` varchar(200) DEFAULT NULL,
  `employee_education` varchar(200) DEFAULT NULL,
  `birth_date` date DEFAULT NULL,
  `business_phone` varchar(20) DEFAULT NULL,
  `private_phone` varchar(25) DEFAULT NULL,
  `business_mail` varchar(100) DEFAULT NULL,
  `private_mail` varchar(100) DEFAULT NULL,
  `street` varchar(200) DEFAULT NULL,
  `code` varchar(200) DEFAULT NULL,
  `city` varchar(200) DEFAULT NULL,
  `state` varchar(200) DEFAULT NULL,
  `country` varchar(200) DEFAULT NULL,
  `ship_street` varchar(200) DEFAULT NULL,
  `ship_code` varchar(200) DEFAULT NULL,
  `ship_city` varchar(200) DEFAULT NULL,
  `ship_state` varchar(200) DEFAULT NULL,
  `ship_country` varchar(200) DEFAULT NULL,
  `dav_status` tinyint(1) DEFAULT '1',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `secondary_phone` varchar(25) DEFAULT NULL,
  `position` varchar(255) DEFAULT NULL,
  `rbh` decimal(25,8) DEFAULT NULL,
  `business_phone_extra` varchar(100) DEFAULT NULL,
  `private_phone_extra` varchar(100) DEFAULT NULL,
  `secondary_phone_extra` varchar(100) DEFAULT NULL,
  `rut` varchar(32) DEFAULT '',
  `nacionalidad` varchar(255) DEFAULT '',
  `edocivil` varchar(255) DEFAULT '',
  `extension` bigint(32) DEFAULT '0',
  `jefedirecto` int(11) unsigned DEFAULT '0',
  `fingreso` date DEFAULT NULL,
  `tipocontrato` varchar(255) DEFAULT '',
  `bancoempleado` varchar(255) DEFAULT '',
  `tipocuenta` varchar(255) DEFAULT '',
  `nrocuenta` varchar(64) DEFAULT '',
  `prevision` varchar(255) DEFAULT '',
  `sueldoliquido` bigint(64) DEFAULT '0',
  `afp` varchar(255) DEFAULT '',
  `comuna` varchar(255) DEFAULT '',
  `provincia` varchar(255) DEFAULT '',
  `region` varchar(255) DEFAULT '',
  `seriedocumento` varchar(64) DEFAULT '',
  `departamento` text,
  `pasaporte` varchar(59) DEFAULT '',
  PRIMARY KEY (`ossemployeesid`),
  KEY `vtiger_ossemployees_jefedirecto_idx` (`jefedirecto`),
  CONSTRAINT `fk_1_vtiger_ossemployees` FOREIGN KEY (`ossemployeesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossmailview`;
CREATE TABLE `vtiger_ossmailview` (
  `ossmailviewid` int(10) NOT NULL,
  `ossmailview_no` varchar(50) DEFAULT NULL,
  `from_email` text,
  `to_email` text,
  `subject` text,
  `content` text,
  `cc_email` text,
  `bcc_email` text,
  `id` int(10) DEFAULT NULL,
  `mbox` varchar(100) DEFAULT NULL,
  `uid` varchar(150) DEFAULT NULL,
  `cid` char(40) DEFAULT NULL,
  `rc_user` varchar(3) DEFAULT NULL,
  `reply_to_email` text,
  `ossmailview_sendtype` varchar(30) DEFAULT NULL,
  `attachments_exist` smallint(1) DEFAULT '0',
  `type` tinyint(1) DEFAULT NULL,
  `from_id` varchar(50) NOT NULL,
  `to_id` varchar(100) NOT NULL,
  `orginal_mail` text,
  `verify` smallint(1) DEFAULT '0',
  `rel_mod` varchar(128) DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  PRIMARY KEY (`ossmailviewid`),
  KEY `id` (`id`),
  KEY `verify` (`verify`),
  KEY `message_id` (`uid`,`rc_user`),
  KEY `mbox` (`mbox`),
  KEY `ossmailview_cid_idx` (`cid`),
  CONSTRAINT `fk_1_vtiger_ossmailview` FOREIGN KEY (`ossmailviewid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossoutsourcedservices`;
CREATE TABLE `vtiger_ossoutsourcedservices` (
  `ossoutsourcedservicesid` int(10) NOT NULL DEFAULT '0',
  `ossoutsourcedservices_no` varchar(255) DEFAULT NULL,
  `productname` varchar(100) DEFAULT '',
  `osservicesstatus` varchar(50) DEFAULT NULL,
  `pscategory` varchar(255) DEFAULT NULL,
  `datesold` date DEFAULT NULL,
  `dateinservice` date DEFAULT NULL,
  `wherebought` varchar(100) DEFAULT '',
  `parent_id` int(10) DEFAULT NULL,
  `ssalesprocessesid` int(10) DEFAULT NULL,
  PRIMARY KEY (`ossoutsourcedservicesid`),
  KEY `parent_id` (`parent_id`),
  KEY `ssalesprocessesid` (`ssalesprocessesid`),
  CONSTRAINT `fk_1_vtiger_ossoutsourcedservices` FOREIGN KEY (`ossoutsourcedservicesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_osspasswords`;
CREATE TABLE `vtiger_osspasswords` (
  `osspasswordsid` int(10) NOT NULL,
  `osspassword_no` varchar(100) NOT NULL,
  `passwordname` varchar(100) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varbinary(200) NOT NULL,
  `link_adres` varchar(255) DEFAULT NULL,
  `linkto` int(10) DEFAULT NULL,
  `linkextend` int(10) DEFAULT NULL,
  PRIMARY KEY (`osspasswordsid`),
  KEY `linkto` (`linkto`),
  KEY `linkextend` (`linkextend`),
  CONSTRAINT `fk_1_vtiger_osspasswords` FOREIGN KEY (`osspasswordsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_osssoldservices`;
CREATE TABLE `vtiger_osssoldservices` (
  `osssoldservicesid` int(10) NOT NULL DEFAULT '0',
  `osssoldservices_no` varchar(255) DEFAULT NULL,
  `productname` varchar(255) DEFAULT '',
  `ssservicesstatus` varchar(255) DEFAULT NULL,
  `pscategory` varchar(255) DEFAULT '',
  `datesold` date DEFAULT NULL,
  `dateinservice` date DEFAULT NULL,
  `invoice` varchar(255) DEFAULT '',
  `parent_id` int(10) DEFAULT NULL,
  `serviceid` int(10) DEFAULT NULL,
  `ordertime` decimal(10,2) DEFAULT NULL,
  `ssalesprocessesid` int(10) DEFAULT NULL,
  `osssoldservices_renew` varchar(255) DEFAULT NULL,
  `renewalinvoice` int(10) DEFAULT NULL,
  `contactid` int(19) DEFAULT NULL,
  PRIMARY KEY (`osssoldservicesid`),
  KEY `parent_id` (`parent_id`),
  KEY `serviceid` (`serviceid`),
  KEY `ssalesprocessesid` (`ssalesprocessesid`),
  KEY `renewalinvoice` (`renewalinvoice`),
  KEY `contactid_idx` (`contactid`),
  CONSTRAINT `fk_1_vtiger_osssoldservices` FOREIGN KEY (`osssoldservicesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_osstimecontrol`;
CREATE TABLE `vtiger_osstimecontrol` (
  `osstimecontrolid` int(10) NOT NULL DEFAULT '0',
  `name` varchar(128) DEFAULT NULL,
  `osstimecontrol_no` varchar(255) DEFAULT NULL,
  `osstimecontrol_status` varchar(128) DEFAULT NULL,
  `date_start` date NOT NULL,
  `time_start` varchar(50) DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `time_end` varchar(50) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `deleted` int(1) DEFAULT '0',
  `timecontrol_type` varchar(255) DEFAULT NULL,
  `process` int(10) DEFAULT NULL,
  `link` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  `linkextend` int(10) DEFAULT NULL,
  PRIMARY KEY (`osstimecontrolid`),
  KEY `on_update_cascade` (`deleted`),
  KEY `osstimecontrol_status_9` (`osstimecontrol_status`,`deleted`),
  KEY `osstimecontrol_status_6` (`osstimecontrol_status`),
  KEY `subprocess` (`subprocess`),
  KEY `link` (`link`),
  KEY `process` (`process`),
  KEY `linkextend` (`linkextend`),
  CONSTRAINT `vtiger_osstimecontrol` FOREIGN KEY (`osstimecontrolid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_outsourcedproducts`;
CREATE TABLE `vtiger_outsourcedproducts` (
  `outsourcedproductsid` int(10) NOT NULL DEFAULT '0',
  `asset_no` varchar(32) DEFAULT NULL,
  `productname` varchar(255) DEFAULT NULL,
  `datesold` date DEFAULT NULL,
  `dateinservice` date DEFAULT NULL,
  `oproductstatus` varchar(255) DEFAULT NULL,
  `pscategory` varchar(255) DEFAULT '',
  `wherebought` varchar(255) DEFAULT '',
  `prodcount` varchar(255) DEFAULT '',
  `parent_id` int(10) DEFAULT NULL,
  `ssalesprocessesid` int(10) DEFAULT NULL,
  PRIMARY KEY (`outsourcedproductsid`),
  KEY `parent_id` (`parent_id`),
  KEY `ssalesprocessesid` (`ssalesprocessesid`),
  CONSTRAINT `fk_1_vtiger_outsourcedproducts` FOREIGN KEY (`outsourcedproductsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_paymentsin`;
CREATE TABLE `vtiger_paymentsin` (
  `paymentsinid` int(10) NOT NULL DEFAULT '0',
  `paymentsvalue` decimal(25,3) DEFAULT NULL,
  `paymentsno` varchar(32) DEFAULT NULL,
  `paymentsname` varchar(128) DEFAULT NULL,
  `paymentstitle` text,
  `paymentscurrency` varchar(32) DEFAULT NULL,
  `bank_account` varchar(128) DEFAULT NULL,
  `paymentsin_status` varchar(128) DEFAULT NULL,
  `relatedid` int(10) DEFAULT NULL,
  `nrofactura` varchar(32) DEFAULT '',
  `indemnizacion` bigint(64) DEFAULT '0',
  `valorfactura` bigint(64) DEFAULT '0',
  `ffactura` date DEFAULT NULL,
  `banco` varchar(32) DEFAULT '',
  `fvencimientofactura` date DEFAULT NULL,
  `diasvencidos` int(8) DEFAULT '0',
  `notificado` tinyint(1) DEFAULT '0',
  `fnotificacion` date DEFAULT NULL,
  `ndividendos` int(8) DEFAULT '0',
  `fpagodividendos` date DEFAULT NULL,
  `fcompromiso` date DEFAULT NULL,
  `observaciones` text,
  `valor1cuota` bigint(64) DEFAULT '0',
  `valor2cuota` bigint(64) DEFAULT '0',
  `valor3cuota` bigint(64) DEFAULT '0',
  `f1cuota` date DEFAULT NULL,
  `f2cuota` date DEFAULT NULL,
  `f3cuota` date DEFAULT NULL,
  `1cuotapagada` tinyint(1) DEFAULT '0',
  `2cuotapagada` tinyint(1) DEFAULT '0',
  `3cuotapagada` tinyint(1) DEFAULT '0',
  `nrosiniestro` int(11) unsigned DEFAULT '0',
  `frecinfliq` date DEFAULT NULL,
  `fpagofactura` date DEFAULT NULL,
  `facturapagada` tinyint(1) DEFAULT '0',
  `cliente` int(11) unsigned DEFAULT '0',
  `captador` varchar(59) DEFAULT '',
  `notificacioncobro1` tinyint(1) DEFAULT '0',
  `f1eranotifcacion` date DEFAULT NULL,
  `ciaseguros` varchar(255) DEFAULT '',
  `valor4cuota` bigint(64) DEFAULT '0',
  `f4cuota` date DEFAULT NULL,
  `4cuotapagada` tinyint(1) DEFAULT '0',
  `fvencuota1` date DEFAULT NULL,
  `fvencuota2` date DEFAULT NULL,
  `fvencuota3` date DEFAULT NULL,
  `fvencuota4` date DEFAULT NULL,
  `valor5cuota` bigint(64) DEFAULT '0',
  `valor6cuota` bigint(64) DEFAULT '0',
  `fvencuota5` date DEFAULT NULL,
  `fvencuota6` date DEFAULT NULL,
  `5cuotapagada` tinyint(1) DEFAULT '0',
  `6cuotapagada` tinyint(1) DEFAULT '0',
  `f5cuota` date DEFAULT NULL,
  `f6cuota` date DEFAULT NULL,
  `fprobpagocia` date DEFAULT NULL,
  `numerosiniestrocaso` varchar(32) DEFAULT '',
  `analistacia` varchar(59) DEFAULT '',
  `correoanalista` varchar(100) DEFAULT '',
  `tlfanalista` varchar(30) DEFAULT '',
  `tlfanalista_extra` varchar(100) DEFAULT NULL,
  `obsanalista` text,
  `observacionpago` text,
  `notificacioncobro2` tinyint(1) DEFAULT '0',
  `f2danotificacion` date DEFAULT NULL,
  `recordatorio` tinyint(1) DEFAULT '0',
  `frecordatorio` date DEFAULT NULL,
  `enviomensajes` tinyint(1) DEFAULT '0',
  `fenviomensajes` date DEFAULT NULL,
  `bancopago` varchar(255) DEFAULT '',
  `tipopago` varchar(255) DEFAULT '',
  `deudaactual` bigint(59) DEFAULT '0',
  `gastocobranza` bigint(59) DEFAULT '0',
  `valorcuota` bigint(59) DEFAULT '0',
  `deudatotal` bigint(59) DEFAULT '0',
  `abono` bigint(59) DEFAULT '0',
  `deudarestante` bigint(59) DEFAULT '0',
  `nrocuotas` varchar(255) DEFAULT '',
  `diapago` varchar(255) DEFAULT '',
  `fprimerpago` date DEFAULT NULL,
  `abonopagado` tinyint(1) DEFAULT '0',
  `fabono` date DEFAULT NULL,
  `tpagoabono` varchar(255) DEFAULT '',
  `bdpago` varchar(255) DEFAULT '',
  `deudainicial` bigint(59) DEFAULT '0',
  `tpago1cuota` varchar(255) DEFAULT '',
  `bdpago1cuota` varchar(255) DEFAULT '',
  `tpago2cuota` varchar(255) DEFAULT '',
  `tpago3cuota` varchar(255) DEFAULT '',
  `tpago4cuota` varchar(255) DEFAULT '',
  `tpago5cuota` varchar(255) DEFAULT '',
  `tpago6cuota` varchar(255) DEFAULT '',
  `bdpago2cuota` varchar(255) DEFAULT '',
  `bdpago3cuota` varchar(255) DEFAULT '',
  `bdpago4cuota` varchar(255) DEFAULT '',
  `bdpago5cuuota` varchar(255) DEFAULT '',
  `bdpago6cuota` varchar(255) DEFAULT '',
  `envfactcliente` tinyint(1) DEFAULT '0',
  `codwebpayabono` bigint(12) DEFAULT '0',
  `codwebpaycuota1` bigint(12) DEFAULT '0',
  `codwebpaycuota2` bigint(12) DEFAULT '0',
  `codwebpaycuota3` bigint(12) DEFAULT '0',
  `codwebpaycuota4` bigint(12) DEFAULT '0',
  `codwebpaycuota5` bigint(12) DEFAULT '0',
  `codwebpaycuota6` bigint(12) DEFAULT '0',
  `tarjpagoabono` varchar(255) DEFAULT '',
  `tarjpagocuota1` varchar(255) DEFAULT '',
  `tarjpagocuota2` varchar(255) DEFAULT '',
  `tarjpagocuota3` varchar(255) DEFAULT '',
  `tarjpagocuota4` varchar(255) DEFAULT '',
  `tarjpagocuota5` varchar(255) DEFAULT '',
  `tarjpagocuota6` varchar(255) DEFAULT '',
  `tipocobranza` varchar(255) DEFAULT '',
  `notificacionpagoliberado` tinyint(1) DEFAULT '0',
  `fnotlibpag` date DEFAULT NULL,
  `cobraz` int(11) unsigned DEFAULT '0',
  `prc` int(11) unsigned DEFAULT '0',
  `crearddacobranza` tinyint(1) DEFAULT '0',
  `relddacobranza` int(11) unsigned DEFAULT '0',
  `crearddapagoretenido` tinyint(1) DEFAULT '0',
  `relddapagoretenido` int(11) unsigned DEFAULT '0',
  `crearrecdeuda` tinyint(1) DEFAULT '0',
  `incumplimientoconvenio` tinyint(1) DEFAULT '0',
  `honorariosabogado` bigint(30) DEFAULT '0',
  `estadogc` varchar(255) DEFAULT '',
  `fechagestuno` date DEFAULT NULL,
  `fechagestdos` date DEFAULT NULL,
  `fechagesttres` date DEFAULT NULL,
  `obsgestcobra` text,
  `estado` varchar(255) DEFAULT '',
  `sinacofi` tinyint(1) DEFAULT '0',
  `tipoddacobranza` varchar(255) DEFAULT '',
  `nrocredito` varchar(30) DEFAULT '',
  `asociadoesterno` varchar(200) DEFAULT '',
  PRIMARY KEY (`paymentsinid`),
  KEY `vtiger_paymentsin_nrosiniestro_idx` (`nrosiniestro`),
  KEY `vtiger_paymentsin_cliente_idx` (`cliente`),
  KEY `vtiger_paymentsin_cobraz_idx` (`cobraz`),
  KEY `vtiger_paymentsin_prc_idx` (`prc`),
  KEY `vtiger_paymentsin_relddacobranza_idx` (`relddacobranza`),
  KEY `vtiger_paymentsin_relddapagoretenido_idx` (`relddapagoretenido`),
  CONSTRAINT `fk_1_vtiger_paymentsin` FOREIGN KEY (`paymentsinid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_paymentsout`;
CREATE TABLE `vtiger_paymentsout` (
  `paymentsoutid` int(10) NOT NULL DEFAULT '0',
  `paymentsvalue` decimal(25,3) DEFAULT NULL,
  `paymentsno` varchar(32) DEFAULT NULL,
  `paymentsname` varchar(128) DEFAULT NULL,
  `paymentstitle` varchar(128) DEFAULT NULL,
  `paymentscurrency` varchar(32) DEFAULT NULL,
  `bank_account` varchar(128) DEFAULT NULL,
  `paymentsout_status` varchar(128) DEFAULT NULL,
  `relatedid` int(10) DEFAULT NULL,
  `parentid` int(10) DEFAULT NULL,
  PRIMARY KEY (`paymentsoutid`),
  CONSTRAINT `fk_1_vtiger_paymentsout` FOREIGN KEY (`paymentsoutid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pbxmanager`;
CREATE TABLE `vtiger_pbxmanager` (
  `pbxmanagerid` int(10) NOT NULL AUTO_INCREMENT,
  `direction` varchar(10) DEFAULT NULL,
  `callstatus` varchar(20) DEFAULT NULL,
  `starttime` datetime DEFAULT NULL,
  `endtime` datetime DEFAULT NULL,
  `totalduration` int(10) DEFAULT NULL,
  `billduration` int(10) DEFAULT NULL,
  `recordingurl` varchar(200) DEFAULT NULL,
  `sourceuuid` varchar(100) DEFAULT NULL,
  `gateway` varchar(20) DEFAULT NULL,
  `customer` int(10) DEFAULT NULL,
  `user` varchar(100) DEFAULT NULL,
  `customernumber` varchar(100) DEFAULT NULL,
  `customertype` varchar(100) DEFAULT NULL,
  `customernumber_extra` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`pbxmanagerid`),
  KEY `index_sourceuuid` (`sourceuuid`),
  KEY `index_pbxmanager_id` (`pbxmanagerid`),
  CONSTRAINT `vtiger_pbxmanager_ibfk_1` FOREIGN KEY (`pbxmanagerid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pbxmanager_phonelookup`;
CREATE TABLE `vtiger_pbxmanager_phonelookup` (
  `crmid` int(10) DEFAULT NULL,
  `setype` varchar(30) DEFAULT NULL,
  `fnumber` varchar(100) DEFAULT NULL,
  `rnumber` varchar(100) DEFAULT NULL,
  `fieldname` varchar(50) DEFAULT NULL,
  UNIQUE KEY `unique_key` (`crmid`,`setype`,`fieldname`),
  KEY `index_phone_number` (`fnumber`,`rnumber`),
  CONSTRAINT `vtiger_pbxmanager_phonelookup_ibfk_1` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_preaprobacioncredi`;
CREATE TABLE `vtiger_preaprobacioncredi` (
  `preaprobacioncrediid` int(11) NOT NULL DEFAULT '0',
  `preaprobacioncredi` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `anovehiculo` varchar(255) DEFAULT '',
  `cae` decimal(5,2) DEFAULT NULL,
  `comisionporciento` decimal(5,2) DEFAULT NULL,
  `preaprobado` tinyint(1) DEFAULT '0',
  `plazopa` varchar(255) DEFAULT '',
  `valorpie` varchar(255) DEFAULT '',
  `apellidoss` varchar(64) DEFAULT '',
  `nombres` varchar(64) DEFAULT '',
  `tasapiso` decimal(5,2) DEFAULT NULL,
  `tasatecho` decimal(5,2) DEFAULT NULL,
  `obssistema` text,
  `obsasesor` text,
  `edad` int(8) DEFAULT '0',
  `telefono_extra` varchar(100) DEFAULT NULL,
  `movil` varchar(30) DEFAULT '',
  `movil_extra` varchar(100) DEFAULT NULL,
  `correo` varchar(100) DEFAULT '',
  `propiedad` varchar(255) DEFAULT '',
  `nroprotesto` int(8) DEFAULT '0',
  `estadopreaprobacion` varchar(255) DEFAULT '',
  `antlaboral` int(8) DEFAULT '0',
  `checkmorosidad` tinyint(1) DEFAULT '0',
  `obssupervisor` text,
  `valorvehiculo` decimal(65,8) DEFAULT NULL,
  `valorpieneto` decimal(65,8) DEFAULT NULL,
  `rentaliquida` decimal(65,8) DEFAULT NULL,
  `lineacredito` decimal(65,8) DEFAULT NULL,
  `montototalprotesto` decimal(65,8) DEFAULT NULL,
  `montoafinanciar` decimal(65,8) DEFAULT NULL,
  `valorcuota` decimal(65,8) DEFAULT NULL,
  `ctc` decimal(65,8) DEFAULT NULL,
  `comision` decimal(65,8) DEFAULT NULL,
  `alzamientoprenda` decimal(65,8) DEFAULT NULL,
  `constitucionprenda` decimal(65,8) DEFAULT NULL,
  `legalizacionpagare` decimal(65,8) DEFAULT NULL,
  `gastosadministrativos` decimal(65,8) DEFAULT NULL,
  `retirodocumentos` decimal(65,8) DEFAULT NULL,
  `segurocesantia` decimal(65,8) DEFAULT NULL,
  `impuestopagare` decimal(5,2) DEFAULT NULL,
  `montopagare` decimal(65,8) DEFAULT NULL,
  PRIMARY KEY (`preaprobacioncrediid`),
  CONSTRAINT `fk_1_vtiger_preaprobacioncredipreaprobacioncrediid` FOREIGN KEY (`preaprobacioncrediid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pricebook`;
CREATE TABLE `vtiger_pricebook` (
  `pricebookid` int(10) NOT NULL DEFAULT '0',
  `pricebook_no` varchar(100) NOT NULL,
  `bookname` varchar(100) DEFAULT NULL,
  `active` smallint(1) DEFAULT NULL,
  `currency_id` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`pricebookid`),
  CONSTRAINT `fk_1_vtiger_pricebook` FOREIGN KEY (`pricebookid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_products`;
CREATE TABLE `vtiger_products` (
  `productid` int(10) NOT NULL,
  `product_no` varchar(100) NOT NULL,
  `productname` varchar(100) DEFAULT NULL,
  `productcode` varchar(40) DEFAULT NULL,
  `pscategory` varchar(200) DEFAULT NULL,
  `manufacturer` varchar(200) DEFAULT NULL,
  `qty_per_unit` decimal(11,2) DEFAULT '0.00',
  `unit_price` decimal(25,8) DEFAULT NULL,
  `weight` decimal(11,3) DEFAULT NULL,
  `pack_size` int(10) DEFAULT NULL,
  `sales_start_date` date DEFAULT NULL,
  `sales_end_date` date DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `cost_factor` int(10) DEFAULT NULL,
  `commissionrate` decimal(7,3) DEFAULT NULL,
  `commissionmethod` varchar(50) DEFAULT NULL,
  `discontinued` tinyint(1) NOT NULL DEFAULT '0',
  `usageunit` varchar(200) DEFAULT NULL,
  `reorderlevel` int(10) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `mfr_part_no` varchar(200) DEFAULT NULL,
  `vendor_part_no` varchar(200) DEFAULT NULL,
  `serialno` varchar(200) DEFAULT NULL,
  `qtyinstock` decimal(25,3) DEFAULT NULL,
  `productsheet` varchar(200) DEFAULT NULL,
  `qtyindemand` int(10) DEFAULT NULL,
  `glacct` varchar(200) DEFAULT NULL,
  `vendor_id` int(10) DEFAULT NULL,
  `imagename` text,
  `currency_id` int(10) NOT NULL DEFAULT '1',
  `taxes` varchar(50) DEFAULT NULL,
  `ean` varchar(30) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT '',
  `renewable` tinyint(1) DEFAULT '0',
  `category_multipicklist` text,
  PRIMARY KEY (`productid`),
  CONSTRAINT `fk_1_vtiger_products` FOREIGN KEY (`productid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_project`;
CREATE TABLE `vtiger_project` (
  `projectid` int(10) NOT NULL,
  `projectname` varchar(255) DEFAULT NULL,
  `project_no` varchar(100) DEFAULT NULL,
  `startdate` date DEFAULT NULL,
  `targetenddate` date DEFAULT NULL,
  `actualenddate` date DEFAULT NULL,
  `targetbudget` varchar(255) DEFAULT NULL,
  `projecturl` varchar(255) DEFAULT NULL,
  `projectstatus` varchar(100) DEFAULT NULL,
  `projectpriority` varchar(100) DEFAULT NULL,
  `projecttype` varchar(100) DEFAULT NULL,
  `progress` varchar(100) DEFAULT NULL,
  `linktoaccountscontacts` int(10) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `servicecontractsid` int(10) DEFAULT NULL,
  `ssalesprocessesid` int(10) DEFAULT NULL,
  `parentid` int(10) DEFAULT NULL,
  PRIMARY KEY (`projectid`),
  KEY `servicecontractsid` (`servicecontractsid`),
  KEY `linktoaccountscontacts` (`linktoaccountscontacts`),
  KEY `projectname` (`projectname`),
  KEY `ssalesprocessesid` (`ssalesprocessesid`),
  KEY `project_parentid_idx` (`parentid`),
  KEY `project_no` (`project_no`),
  CONSTRAINT `vtiger_project_ibfk_1` FOREIGN KEY (`projectid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projectmilestone`;
CREATE TABLE `vtiger_projectmilestone` (
  `projectmilestoneid` int(10) NOT NULL,
  `projectmilestonename` varchar(255) DEFAULT NULL,
  `projectmilestone_no` varchar(100) DEFAULT NULL,
  `projectmilestonedate` varchar(255) DEFAULT NULL,
  `projectid` int(10) DEFAULT NULL,
  `projectmilestonetype` varchar(100) DEFAULT NULL,
  `projectmilestone_priority` varchar(255) DEFAULT NULL,
  `projectmilestone_progress` varchar(10) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`projectmilestoneid`),
  KEY `projectid` (`projectid`),
  CONSTRAINT `vtiger_projectmilestone_ibfk_1` FOREIGN KEY (`projectmilestoneid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projecttask`;
CREATE TABLE `vtiger_projecttask` (
  `projecttaskid` int(10) NOT NULL,
  `projecttaskname` varchar(255) DEFAULT NULL,
  `projecttask_no` varchar(100) DEFAULT NULL,
  `projecttasktype` varchar(100) DEFAULT NULL,
  `projecttaskpriority` varchar(100) DEFAULT NULL,
  `projecttaskprogress` varchar(100) DEFAULT NULL,
  `startdate` date DEFAULT NULL,
  `enddate` date DEFAULT NULL,
  `projectid` int(10) DEFAULT NULL,
  `projecttasknumber` int(10) DEFAULT NULL,
  `projecttaskstatus` varchar(100) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `parentid` int(10) DEFAULT NULL,
  `projectmilestoneid` int(10) DEFAULT NULL,
  `targetenddate` date DEFAULT NULL,
  `estimated_work_time` decimal(8,2) DEFAULT NULL,
  PRIMARY KEY (`projecttaskid`),
  KEY `parentid` (`parentid`),
  KEY `projectmilestoneid` (`projectmilestoneid`),
  KEY `projectid` (`projectid`),
  KEY `projecttaskname` (`projecttaskname`),
  CONSTRAINT `vtiger_projecttask_ibfk_1` FOREIGN KEY (`projecttaskid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pruebademandacomercial`;
CREATE TABLE `vtiger_pruebademandacomercial` (
  `pruebademandacomercialid` int(11) NOT NULL,
  `pruebaddacom` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `rut` varchar(15) DEFAULT '',
  `nombre` varchar(100) DEFAULT '',
  PRIMARY KEY (`pruebademandacomercialid`),
  CONSTRAINT `fk_1_vtiger_pruebademandacomercialpruebademandacomercialid` FOREIGN KEY (`pruebademandacomercialid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pruebadocumentos`;
CREATE TABLE `vtiger_pruebadocumentos` (
  `pruebadocumentosid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `reldoc` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`pruebadocumentosid`),
  KEY `vtiger_pruebadocumentos_reldoc_idx` (`reldoc`),
  CONSTRAINT `fk_1_vtiger_pruebadocumentospruebadocumentosid` FOREIGN KEY (`pruebadocumentosid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reconocimientodeuda`;
CREATE TABLE `vtiger_reconocimientodeuda` (
  `reconocimientodeudaid` int(11) NOT NULL,
  `id` int(11) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `rut` varchar(20) DEFAULT '',
  `rol` varchar(30) DEFAULT '',
  `caratula` varchar(101) DEFAULT '',
  `tribunalcompetente` varchar(255) DEFAULT '',
  `tribunalradicado` varchar(255) DEFAULT '',
  `estadodda` varchar(255) DEFAULT '',
  `bienesembargados` varchar(255) DEFAULT '',
  `caratuladc` varchar(101) DEFAULT '',
  `roldc` varchar(40) DEFAULT '',
  `estadoddadc` varchar(255) DEFAULT '',
  `resultadoaudiencia` varchar(255) DEFAULT '',
  `generargestprep` tinyint(1) DEFAULT '0',
  `generarcumpleord` tinyint(1) DEFAULT '0',
  `genart44` tinyint(1) DEFAULT '0',
  `generarformato` tinyint(1) DEFAULT '0',
  `generardemanda` tinyint(1) DEFAULT '0',
  `generarautoprueba` tinyint(1) DEFAULT '0',
  `generaroirsentencia` tinyint(1) DEFAULT '0',
  `generarreposicion` tinyint(1) DEFAULT '0',
  `generarrepoyapela` tinyint(1) DEFAULT '0',
  `generarapela` tinyint(1) DEFAULT '0',
  `nombrereceptor` varchar(255) DEFAULT '',
  `comunacliente` varchar(255) DEFAULT '',
  `busquedanegativa` int(3) DEFAULT '0',
  `estadobusqueda` varchar(255) DEFAULT '',
  `not44` int(3) DEFAULT '0',
  `estadonot44` varchar(255) DEFAULT '',
  `notporcedula` int(3) DEFAULT '0',
  `estadonotcedula` varchar(255) DEFAULT '',
  `notpersonal` int(3) DEFAULT '0',
  `estadonotpersonal` varchar(255) DEFAULT '',
  `embargos` int(3) DEFAULT '0',
  `estadoembargo` varchar(255) DEFAULT '',
  `preciobusquedas` bigint(20) DEFAULT '0',
  `precionotcedula` bigint(20) DEFAULT '0',
  `precionot44` bigint(20) DEFAULT '0',
  `precioembargo` bigint(20) DEFAULT '0',
  `precionotpersonal` bigint(20) DEFAULT '0',
  `totalapagar` bigint(30) DEFAULT '0',
  `pagohistorico` bigint(30) DEFAULT '0',
  `estadocobranza` varchar(30) DEFAULT '',
  `indem` bigint(35) DEFAULT '0',
  `ciudadnotificacion` varchar(30) DEFAULT '',
  `direcnot` varchar(30) DEFAULT '',
  `montofact` bigint(30) DEFAULT '0',
  `correo` varchar(30) DEFAULT '',
  `telefono` varchar(30) DEFAULT '',
  `idcobranza` varchar(30) DEFAULT '',
  `relacioncobranza` int(11) unsigned DEFAULT '0',
  `pagar` tinyint(1) DEFAULT '0',
  `rolrecursoqueja` varchar(40) DEFAULT '',
  `claseapelacion` varchar(255) DEFAULT '',
  `rolapelacion` varchar(40) DEFAULT '',
  `clasecasacion` varchar(255) DEFAULT '',
  `rolrecursocasacion` varchar(40) DEFAULT '',
  `rolrecursohecho` varchar(40) DEFAULT '',
  `formatoica` tinyint(1) DEFAULT '0',
  `fechaaudienciaconfe` date DEFAULT NULL,
  `nrofacturasus` varchar(20) DEFAULT '',
  `nrofacturaasesoria` varchar(20) DEFAULT '',
  `fechafacturasus` date DEFAULT NULL,
  `fechafacturaasesoria` date DEFAULT NULL,
  `fechavencimientofacturasus` date DEFAULT NULL,
  `fechavencimientofacturaas` date DEFAULT NULL,
  `totaldeudasus` bigint(30) DEFAULT '0',
  `totaldeudaas` bigint(40) DEFAULT '0',
  `deudatotal` bigint(40) DEFAULT '0',
  `bienesembargadosdc` varchar(255) DEFAULT '',
  `ddasinopsusas` tinyint(1) DEFAULT '0',
  `ddaconopsussas` tinyint(1) DEFAULT '0',
  `generargestprepsusas` tinyint(1) DEFAULT '0',
  `demandado` int(11) unsigned DEFAULT '0',
  `nrocaso` int(11) unsigned DEFAULT '0',
  `comuna` varchar(255) DEFAULT '',
  `tribunalradicadodc` varchar(255) DEFAULT '',
  `cortecompetente` varchar(255) DEFAULT '',
  `tribunalcompetentedc` varchar(255) DEFAULT '',
  `listaprueba` varchar(255) DEFAULT '',
  `fechaaudpend` varchar(255) DEFAULT '',
  PRIMARY KEY (`reconocimientodeudaid`),
  KEY `vtiger_reconocimientodeuda_relacioncobranza_idx` (`relacioncobranza`),
  KEY `vtiger_reconocimientodeuda_demandado_idx` (`demandado`),
  KEY `vtiger_reconocimientodeuda_nrocaso_idx` (`nrocaso`),
  CONSTRAINT `fk_1_vtiger_reconocimientodeudareconocimientodeudaid` FOREIGN KEY (`reconocimientodeudaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservations`;
CREATE TABLE `vtiger_reservations` (
  `reservationsid` int(10) NOT NULL DEFAULT '0',
  `title` varchar(128) DEFAULT NULL,
  `reservations_no` varchar(255) DEFAULT NULL,
  `reservations_status` varchar(128) DEFAULT NULL,
  `date_start` date NOT NULL,
  `time_start` varchar(50) DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `time_end` varchar(50) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `link` int(10) DEFAULT '0',
  `process` int(10) DEFAULT '0',
  `deleted` int(1) DEFAULT '0',
  `type` varchar(128) DEFAULT NULL,
  `subprocess` int(10) DEFAULT '0',
  `linkextend` int(10) DEFAULT NULL,
  PRIMARY KEY (`reservationsid`),
  KEY `process` (`process`),
  KEY `link` (`link`),
  KEY `subprocess` (`subprocess`),
  KEY `linkextend` (`linkextend`),
  KEY `deleted` (`deleted`),
  CONSTRAINT `vtiger_reservations` FOREIGN KEY (`reservationsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_service`;
CREATE TABLE `vtiger_service` (
  `serviceid` int(10) NOT NULL,
  `service_no` varchar(100) NOT NULL,
  `servicename` varchar(255) NOT NULL,
  `pscategory` varchar(200) DEFAULT NULL,
  `qty_per_unit` decimal(11,2) DEFAULT '0.00',
  `unit_price` decimal(25,8) DEFAULT NULL,
  `sales_start_date` date DEFAULT NULL,
  `sales_end_date` date DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `discontinued` tinyint(1) NOT NULL DEFAULT '0',
  `service_usageunit` varchar(200) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `currency_id` int(10) NOT NULL DEFAULT '1',
  `commissionrate` decimal(7,3) DEFAULT NULL,
  `renewable` tinyint(1) DEFAULT '0',
  `taxes` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`serviceid`),
  CONSTRAINT `fk_1_vtiger_service` FOREIGN KEY (`serviceid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_servicecontracts`;
CREATE TABLE `vtiger_servicecontracts` (
  `servicecontractsid` int(10) NOT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `sc_related_to` int(10) DEFAULT NULL,
  `tracking_unit` varchar(100) DEFAULT NULL,
  `total_units` decimal(5,2) DEFAULT NULL,
  `used_units` decimal(5,2) DEFAULT NULL,
  `subject` varchar(100) DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `planned_duration` varchar(256) DEFAULT NULL,
  `actual_duration` varchar(256) DEFAULT NULL,
  `contract_status` varchar(200) DEFAULT NULL,
  `priority` varchar(200) DEFAULT NULL,
  `contract_type` varchar(200) DEFAULT NULL,
  `progress` decimal(5,2) DEFAULT NULL,
  `contract_no` varchar(100) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`servicecontractsid`),
  KEY `sc_related_to` (`sc_related_to`),
  CONSTRAINT `vtiger_servicecontracts_ibfk_1` FOREIGN KEY (`servicecontractsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_siniestro`;
CREATE TABLE `vtiger_siniestro` (
  `siniestroid` int(11) NOT NULL DEFAULT '0',
  `siniestro` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `estado` varchar(255) DEFAULT '',
  `estado_` varchar(255) DEFAULT NULL,
  `banco` varchar(255) DEFAULT '',
  `campana` varchar(255) DEFAULT '',
  `presrecevaluador` tinyint(1) DEFAULT '0',
  `contratofirmado` tinyint(1) DEFAULT '0',
  `frecepcionpresupuestoeval` date DEFAULT NULL,
  `fcontratofirmado` date DEFAULT NULL,
  `presupuestorevisado` tinyint(1) DEFAULT '0',
  `comentariocontrato` text,
  `frevpresupuesto` date DEFAULT NULL,
  `doctosendec` tinyint(1) DEFAULT '0',
  `obscaso` text,
  `direccionsiniestro` text,
  `comunacaso` varchar(255) DEFAULT '',
  `ciudadcaso` varchar(255) DEFAULT '',
  `mts2` decimal(11,2) DEFAULT NULL,
  `tipopropiedad` varchar(255) DEFAULT '',
  `tiposiniestro` varchar(255) DEFAULT '',
  `nropoliza` varchar(16) DEFAULT '',
  `fsismo` varchar(255) DEFAULT '',
  `nrosiniestro` varchar(16) DEFAULT '',
  `ciaseguros` varchar(255) DEFAULT '',
  `ffiltracionotro` date DEFAULT NULL,
  `quiendenuncio` varchar(255) DEFAULT '',
  `formadenuncia` varchar(255) DEFAULT '',
  `nrodeatencion` varchar(16) DEFAULT '',
  `tlfcontacto` varchar(255) DEFAULT '',
  `entliquidadora` varchar(255) DEFAULT '',
  `infliqimpugnado` tinyint(1) DEFAULT '0',
  `fdenuncio` date DEFAULT NULL,
  `fimpugnacion` date DEFAULT NULL,
  `fasignacionliq` date DEFAULT NULL,
  `respimpugnacion` tinyint(1) DEFAULT '0',
  `fvisita` date DEFAULT NULL,
  `frespimpugnacion` date DEFAULT NULL,
  `actarecibida` tinyint(1) DEFAULT '0',
  `nombreinspector` varchar(32) DEFAULT '',
  `factarecibida` date DEFAULT NULL,
  `nombreanalista` varchar(32) DEFAULT '',
  `fpresupuesto` date DEFAULT NULL,
  `emailanalista` varchar(100) DEFAULT '',
  `evalasignado` varchar(255) DEFAULT '',
  `fpreinforme` date DEFAULT NULL,
  `observacion` text,
  `frecinfliq` date DEFAULT NULL,
  `freinspeccion` date DEFAULT NULL,
  `nrocarpeta` varchar(16) DEFAULT '',
  `evalreinspeccion` varchar(255) DEFAULT '',
  `reinspeccion` tinyint(1) DEFAULT '0',
  `fprorroga` date DEFAULT NULL,
  `declaracionjurada` tinyint(1) DEFAULT '0',
  `venprorroga` date DEFAULT NULL,
  `envdecjurada` date DEFAULT NULL,
  `prorrogado` tinyint(1) DEFAULT '0',
  `perdidareclamada` decimal(19,2) DEFAULT NULL,
  `nrofactura` varchar(16) DEFAULT '',
  `perdidadeterminada` decimal(19,2) DEFAULT NULL,
  `ffactura` date DEFAULT NULL,
  `deducibleafecto` decimal(19,2) DEFAULT NULL,
  `perdidaindemnizable` decimal(19,2) DEFAULT NULL,
  `fpagofactura` date DEFAULT NULL,
  `fprobpagocia` date DEFAULT NULL,
  `fprobablepago` date DEFAULT NULL,
  `observaciones` text,
  `facturapagada` tinyint(1) DEFAULT '0',
  `comprobantepagoenviado` tinyint(1) DEFAULT '0',
  `fcomprobanteenviado` date DEFAULT NULL,
  `facturarinforme` tinyint(1) DEFAULT '0',
  `informefacturado` tinyint(1) DEFAULT '0',
  `nvaperdidadet` decimal(19,2) DEFAULT NULL,
  `nvaperdidaindemnizable` decimal(19,2) DEFAULT NULL,
  `faddendumrebaja` date DEFAULT NULL,
  `facturaraddendum1` tinyint(1) DEFAULT '0',
  `addendum1facturado` tinyint(1) DEFAULT '0',
  `nrofacturaaddedum1` bigint(16) DEFAULT '0',
  `ffacturaaddendum1` date DEFAULT NULL,
  `frecepaddendum1` date DEFAULT NULL,
  `fimpugaddendum1` date DEFAULT NULL,
  `frespimpugaddendum1` date DEFAULT NULL,
  `obsimpugaddendum1` text,
  `frecepaddendum2` date DEFAULT NULL,
  `facturaraddendum2` tinyint(1) DEFAULT '0',
  `addendum2facturado` tinyint(1) DEFAULT '0',
  `nrofacturaaddendum2` bigint(16) DEFAULT '0',
  `montofacturaaddendum2` bigint(16) DEFAULT '0',
  `ffacturaaddendum2` date DEFAULT NULL,
  `solucion` text,
  `cartaenviopresupuesto` tinyint(1) DEFAULT '0',
  `cartarecepinfliq` tinyint(1) DEFAULT '0',
  `captador` varchar(255) DEFAULT '',
  `quienenvioppto` varchar(255) DEFAULT '',
  `comunadelcaso` varchar(255) DEFAULT '',
  `provinciadelcaso` varchar(255) DEFAULT '',
  `regiondelcaso` varchar(255) DEFAULT '',
  `montopresupuesto` bigint(64) DEFAULT '0',
  `valorfactura` bigint(64) DEFAULT '0',
  `montofacturaaddendum1` bigint(64) DEFAULT '0',
  `valorufestimado` bigint(64) DEFAULT '0',
  `nombrecliente` int(11) unsigned DEFAULT '0',
  `fedoprogreso` date DEFAULT NULL,
  `fedoliqasig` date DEFAULT NULL,
  `fedovisprog` date DEFAULT NULL,
  `fedovisreal` date DEFAULT NULL,
  `fedoesperando` date DEFAULT NULL,
  `edocomercialasesor` varchar(255) DEFAULT '',
  `montoesperado` decimal(22,8) DEFAULT NULL,
  `montoesperadofirma` decimal(22,8) DEFAULT NULL,
  `montoesperadovisita` decimal(22,8) DEFAULT NULL,
  `firmapagada` tinyint(1) DEFAULT '0',
  `convisitapagada` tinyint(1) DEFAULT '0',
  `fpagofirma` date DEFAULT NULL,
  `fpagovisitaasesor` date DEFAULT NULL,
  `montototalrecibido` decimal(22,8) DEFAULT NULL,
  `obsdelsistema` text,
  `descontado` tinyint(1) DEFAULT '0',
  `fdescuento` date DEFAULT NULL,
  `indemnizacion` bigint(64) DEFAULT '0',
  `valoruf` decimal(62,2) DEFAULT NULL,
  `rechazocia` tinyint(1) DEFAULT '0',
  `montoaddendum1` decimal(65,2) DEFAULT NULL,
  `montoaddendum2` decimal(22,2) DEFAULT NULL,
  `pertenecealgrupo` varchar(255) DEFAULT '',
  `rechazoliqcob` tinyint(1) DEFAULT '0',
  `clasificadodemanda` tinyint(1) DEFAULT '0',
  `fclasificaciondemanda` date DEFAULT NULL,
  `gestionardemanda` tinyint(1) DEFAULT '0',
  `fgestionardemanda` date DEFAULT NULL,
  `bancopago` varchar(255) DEFAULT '',
  `tipopago` varchar(255) DEFAULT '',
  `cartaresolucion` tinyint(1) DEFAULT '0',
  `freccartares` date DEFAULT NULL,
  `conpago` tinyint(1) DEFAULT '0',
  `tipoinspeccion` varchar(255) DEFAULT '',
  `cargofijo` tinyint(1) DEFAULT '0',
  `facurarcf` tinyint(1) DEFAULT '0',
  `descuentocf` tinyint(1) DEFAULT '0',
  `facturadocf` tinyint(1) DEFAULT '0',
  `fpreinsp` date DEFAULT NULL,
  `evalpreinsp` varchar(255) DEFAULT '',
  `preinsprealizada` tinyint(1) DEFAULT '0',
  `presupuestopreinsprecibido` tinyint(1) DEFAULT '0',
  `fpresrecpreinsp` date DEFAULT NULL,
  `prespreinsprevisado` tinyint(1) DEFAULT '0',
  `frevpresupuestopreinsp` date DEFAULT NULL,
  `inicoberpoliza` date DEFAULT NULL,
  `fincoberpoliza` date DEFAULT NULL,
  `rutciaseguros` varchar(255) DEFAULT '',
  `direccionciaseguros` varchar(255) DEFAULT '',
  `nreprelegal` varchar(255) DEFAULT '',
  `antigpropiedad` varchar(255) DEFAULT '',
  `enviocertinsp` tinyint(1) DEFAULT '0',
  `fentregacarta` date DEFAULT NULL,
  `fconocimientodanos` date DEFAULT NULL,
  `cobertura` varchar(255) DEFAULT '',
  `pago` varchar(255) DEFAULT '',
  `deducible` varchar(255) DEFAULT '',
  `fueraplazo` tinyint(1) DEFAULT '0',
  `nexocausal` tinyint(1) DEFAULT '0',
  `sindano` tinyint(1) DEFAULT '0',
  `obsanalisis` text,
  `gestionprevia` tinyint(1) DEFAULT '0',
  `cobertura2` varchar(255) DEFAULT '',
  `deducible2` varchar(255) DEFAULT '',
  `causalesmixtas` varchar(255) DEFAULT '',
  `objsincobmix` text,
  `objconcob` text,
  `objsincobpur` text,
  `indemaddendum1` bigint(24) DEFAULT '0',
  `facturaaddendumpagada1` tinyint(1) DEFAULT '0',
  `fvenfacturaaddendum1` date DEFAULT NULL,
  `fpagofacturaaddendum1` date DEFAULT NULL,
  `bancopagoaddendum1` varchar(255) DEFAULT '',
  `tipopagoaddendum1` varchar(255) DEFAULT '',
  `asesorseguros` tinyint(1) DEFAULT '0',
  `fsismo_nuevo` varchar(255) DEFAULT '',
  `obspreinforme` text,
  `lugarsismo` varchar(255) DEFAULT '',
  `cobertura3` varchar(255) DEFAULT '',
  `deducible3` varchar(255) DEFAULT '',
  `causalesmixtas2` varchar(255) DEFAULT '',
  `objsincobmix2` text,
  `objconcob2` text,
  `objsincobpur2` text,
  `obsinformefin` text,
  `foliocontrato` int(6) DEFAULT '0',
  `captadorfree` varchar(255) DEFAULT '',
  `pagofreelance` tinyint(1) DEFAULT '0',
  `gestcorredorreccob` tinyint(1) DEFAULT '0',
  `gestcorredorotros` tinyint(1) DEFAULT '0',
  `mandtomconfir` tinyint(1) DEFAULT '0',
  `corr_seg` varchar(255) DEFAULT '',
  `gest_ext` varchar(255) DEFAULT '',
  `imp_comp` tinyint(1) DEFAULT '0',
  `fecha_rec_imp_comp` date DEFAULT NULL,
  `resp_imp_comp` tinyint(1) DEFAULT '0',
  `fech_resp_imp_comp` date DEFAULT NULL,
  `tip_rec` varchar(255) DEFAULT '',
  `obs_ase_leg` varchar(25) DEFAULT '',
  `est_liq` varchar(255) DEFAULT '',
  `cau_as_le` text,
  `noaplicacobroseguro` tinyint(1) DEFAULT '0',
  `crearddacom` tinyint(1) DEFAULT '0',
  `crearddacober` tinyint(1) DEFAULT '0',
  `perdrecuperableuf` decimal(8,2) DEFAULT NULL,
  `perdrecuperablepesos` int(10) DEFAULT '0',
  `plazoinfliq` date DEFAULT NULL,
  `desctoas` tinyint(1) DEFAULT '0',
  `tipodesctoas` varchar(30) DEFAULT '',
  `idsiniestroreporte` int(15) DEFAULT NULL,
  `idclientereporte` int(15) DEFAULT NULL,
  `idgestddareporte` int(15) DEFAULT NULL,
  `razonnoaplica` varchar(255) DEFAULT '',
  `comisionpagada` tinyint(1) DEFAULT '0',
  `fechapagocomision` date DEFAULT NULL,
  `valorplan` varchar(255) DEFAULT '',
  `interesadodda` tinyint(1) DEFAULT '0',
  `indadddos` bigint(30) DEFAULT '0',
  `fechaimpgadddos` date DEFAULT NULL,
  `obsimpgadddos` varchar(120) DEFAULT '',
  `fecharespuestaimpudos` date DEFAULT NULL,
  `factadddospag` tinyint(1) DEFAULT '0',
  `fechavenfactadddos` date DEFAULT NULL,
  `fechapagfactadddos` date DEFAULT NULL,
  `bancopagoadddos` varchar(60) DEFAULT '',
  `tipodepagoadddos` varchar(60) DEFAULT '',
  `contratofirmado2` tinyint(1) DEFAULT '0',
  `contratofirmado3` tinyint(1) NOT NULL DEFAULT '0',
  `hora_preinspeccion` time DEFAULT NULL,
  `hravisita` time DEFAULT NULL,
  `correorecpre` tinyint(1) DEFAULT '0',
  `correorecvisliq` tinyint(1) DEFAULT '0',
  `ddaingresada` tinyint(1) DEFAULT '0',
  `docenplataforma` tinyint(1) DEFAULT '0',
  `comentcontrato` text,
  `abonopagado` tinyint(1) DEFAULT '0',
  `fechaintento1` date DEFAULT NULL,
  `fechaintento2` date DEFAULT NULL,
  `fechaintento3` date DEFAULT NULL,
  `comentariabono` text,
  `mandatoenplata` tinyint(1) DEFAULT '0',
  `fechamandayotrosfirma` date DEFAULT NULL,
  `fonoanalista` varchar(25) DEFAULT '',
  `estado_pf` tinyint(1) DEFAULT '0',
  `descargadoc` varchar(255) DEFAULT '',
  `rut` varchar(30) DEFAULT '',
  `nuevocriterioct` tinyint(1) DEFAULT '0',
  `porcentajepago` int(3) DEFAULT '0',
  `ddaliquidador` tinyint(1) DEFAULT '0',
  `crearvtadda` tinyint(1) DEFAULT '0',
  `comentaripre` text,
  `fechaavisopre` date DEFAULT NULL,
  `fechaavisopretres` date DEFAULT NULL,
  `fechaavisovisita` date DEFAULT NULL,
  `fechaavisotres` date DEFAULT NULL,
  `solcontact` varchar(255) DEFAULT '',
  `estadollamadauno` varchar(255) DEFAULT '',
  `estadollamadados` varchar(255) DEFAULT '',
  `estadollamadatres` varchar(255) DEFAULT '',
  `fechallamadauno` date DEFAULT NULL,
  `fechallamadados` date DEFAULT NULL,
  `fechallamadatres` date DEFAULT NULL,
  `obsllamada` text,
  `contactowsp` tinyint(1) DEFAULT '0',
  `enviocorreoregllamada` tinyint(1) DEFAULT '0',
  `diavolverallamar` date DEFAULT NULL,
  `horavolverllamar` time DEFAULT NULL,
  `fechacontactowsp` date DEFAULT NULL,
  `nroreprogramacion` varchar(255) DEFAULT '',
  `estadoreprogramacion` varchar(255) DEFAULT '',
  `fechapreinsp` date DEFAULT NULL,
  `evapre` varchar(255) DEFAULT '',
  `ex_captador` varchar(100) DEFAULT '',
  `arrendatario` varchar(100) DEFAULT '',
  `reprogramadosos` tinyint(1) DEFAULT '0',
  `estadossos` varchar(255) DEFAULT '',
  `retencionventas` varchar(255) DEFAULT '',
  `reas` int(1) NOT NULL DEFAULT '0',
  `estadoprogreso` varchar(255) DEFAULT '',
  `mandatofirmado` tinyint(1) DEFAULT '0',
  `descargarmandato` varchar(255) DEFAULT '',
  `tomadeconocimiento` tinyint(1) DEFAULT '0',
  `descargartomadeconocimiento` varchar(255) DEFAULT '',
  `declaracionjuradafirmada` tinyint(1) DEFAULT '0',
  `descargardeclaracionjurada` varchar(255) DEFAULT '',
  `certificadodeinspeccionfirmado` tinyint(1) DEFAULT '0',
  `descargarcertificadoinspeccion` varchar(255) DEFAULT '',
  `ftomadeconocimiento` date DEFAULT NULL,
  `estado_pf_tc` tinyint(1) DEFAULT '0',
  `fechacertificadoinspeccion` date DEFAULT NULL,
  `fechadecalracionjurada` date DEFAULT NULL,
  `fechamandatofirmado` date DEFAULT NULL,
  `obscasoesp` text,
  `volverallamar` tinyint(1) DEFAULT '0',
  `fechavolverallamar` date DEFAULT NULL,
  `obsvolverallamar` text,
  `id_fact_relBase_sus` varchar(200) DEFAULT '0',
  `estado_factura_sii` varchar(200) NOT NULL,
  `fecha_siniestro` date DEFAULT NULL,
  `id_fact_relBase_hono` varchar(200) NOT NULL DEFAULT '0',
  `razongestionarprogreso` varchar(255) DEFAULT '',
  `ffacturapagada` tinyint(1) DEFAULT '0',
  `nombrearrendatario` varchar(200) DEFAULT '',
  `telefonoarrendatario` varchar(200) DEFAULT '',
  `conarrendatario` tinyint(1) DEFAULT '0',
  `id_fact_relbase_hono_adendum` varchar(100) DEFAULT '0',
  `latitud_sini` varchar(100) DEFAULT '',
  `longitud_sini` varchar(100) DEFAULT '',
  `georeferenciado_estado` tinyint(1) DEFAULT '0',
  `nronotacredito` varchar(30) DEFAULT '',
  `evasig_pre_ins_ins` varchar(100) DEFAULT '',
  `hravisita_pre_ins_ins` time DEFAULT NULL,
  `nom_isnpec_pre_ins_ins` varchar(100) DEFAULT '',
  `obs_pre_ins_ins` varchar(100) DEFAULT '',
  `faviso_pre_ins_ins` date DEFAULT NULL,
  `favisovisita3dias_pre_ins_ins` date DEFAULT NULL,
  `progra_pre_ins_ins` tinyint(1) DEFAULT '0',
  `fvisita_pre_ins_ins` date DEFAULT NULL,
  `facta_pre_ins_ins` date DEFAULT NULL,
  `coor_completa` varchar(200) DEFAULT '',
  `confirmapreinspeccion` tinyint(1) DEFAULT '0',
  `confirmainspeccion` tinyint(1) DEFAULT '0',
  `mark_provisoria` int(11) NOT NULL,
  `clienteinformado` tinyint(1) DEFAULT '0',
  `fechaclinfo` date DEFAULT NULL,
  `obsclinformado` text,
  `solparagestionarprogreso` varchar(255) DEFAULT '',
  `rangohorpre` varchar(255) DEFAULT '',
  `diasdisppre` text,
  `fonoinspector` varchar(50) DEFAULT '',
  `mailinspector` varchar(50) DEFAULT '',
  `asociadoesterno` varchar(255) DEFAULT '',
  `canalcaptacion` varchar(255) DEFAULT '',
  `creadaaslegal` tinyint(1) DEFAULT '0',
  `docugenfirmado` tinyint(1) DEFAULT '0',
  `descargardg` varchar(255) DEFAULT '',
  PRIMARY KEY (`siniestroid`),
  KEY `vtiger_siniestro_nombrecliente_idx` (`nombrecliente`),
  CONSTRAINT `fk_1_vtiger_siniestrosiniestroid` FOREIGN KEY (`siniestroid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_siniestro_pp`;
CREATE TABLE `vtiger_siniestro_pp` (
  `siniestroid` int(11) NOT NULL DEFAULT '0',
  `siniestro` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `estado` varchar(255) DEFAULT '',
  `estado_` varchar(255) DEFAULT NULL,
  `banco` varchar(255) DEFAULT '',
  `campana` varchar(255) DEFAULT '',
  `presrecevaluador` tinyint(1) DEFAULT '0',
  `contratofirmado` tinyint(1) DEFAULT '0',
  `frecepcionpresupuestoeval` date DEFAULT NULL,
  `fcontratofirmado` date DEFAULT NULL,
  `presupuestorevisado` tinyint(1) DEFAULT '0',
  `comentariocontrato` text,
  `frevpresupuesto` date DEFAULT NULL,
  `doctosendec` tinyint(1) DEFAULT '0',
  `obscaso` text,
  `direccionsiniestro` text,
  `comunacaso` varchar(255) DEFAULT '',
  `ciudadcaso` varchar(255) DEFAULT '',
  `mts2` decimal(11,2) DEFAULT NULL,
  `tipopropiedad` varchar(255) DEFAULT '',
  `tiposiniestro` varchar(255) DEFAULT '',
  `nropoliza` varchar(16) DEFAULT '',
  `fsismo` varchar(255) DEFAULT '',
  `nrosiniestro` varchar(16) DEFAULT '',
  `ciaseguros` varchar(255) DEFAULT '',
  `ffiltracionotro` date DEFAULT NULL,
  `quiendenuncio` varchar(255) DEFAULT '',
  `formadenuncia` varchar(255) DEFAULT '',
  `nrodeatencion` varchar(16) DEFAULT '',
  `tlfcontacto` varchar(255) DEFAULT '',
  `entliquidadora` varchar(255) DEFAULT '',
  `infliqimpugnado` tinyint(1) DEFAULT '0',
  `fdenuncio` date DEFAULT NULL,
  `fimpugnacion` date DEFAULT NULL,
  `fasignacionliq` date DEFAULT NULL,
  `respimpugnacion` tinyint(1) DEFAULT '0',
  `fvisita` date DEFAULT NULL,
  `frespimpugnacion` date DEFAULT NULL,
  `actarecibida` tinyint(1) DEFAULT '0',
  `nombreinspector` varchar(32) DEFAULT '',
  `factarecibida` date DEFAULT NULL,
  `nombreanalista` varchar(32) DEFAULT '',
  `fpresupuesto` date DEFAULT NULL,
  `emailanalista` varchar(100) DEFAULT '',
  `evalasignado` varchar(255) DEFAULT '',
  `fpreinforme` date DEFAULT NULL,
  `observacion` text,
  `frecinfliq` date DEFAULT NULL,
  `freinspeccion` date DEFAULT NULL,
  `nrocarpeta` varchar(16) DEFAULT '',
  `evalreinspeccion` varchar(255) DEFAULT '',
  `reinspeccion` tinyint(1) DEFAULT '0',
  `fprorroga` date DEFAULT NULL,
  `declaracionjurada` tinyint(1) DEFAULT '0',
  `venprorroga` date DEFAULT NULL,
  `envdecjurada` date DEFAULT NULL,
  `prorrogado` tinyint(1) DEFAULT '0',
  `perdidareclamada` decimal(19,2) DEFAULT NULL,
  `nrofactura` varchar(16) DEFAULT '',
  `perdidadeterminada` decimal(19,2) DEFAULT NULL,
  `ffactura` date DEFAULT NULL,
  `deducibleafecto` decimal(19,2) DEFAULT NULL,
  `perdidaindemnizable` decimal(19,2) DEFAULT NULL,
  `fpagofactura` date DEFAULT NULL,
  `fprobpagocia` date DEFAULT NULL,
  `fprobablepago` date DEFAULT NULL,
  `observaciones` text,
  `facturapagada` tinyint(1) DEFAULT '0',
  `comprobantepagoenviado` tinyint(1) DEFAULT '0',
  `fcomprobanteenviado` date DEFAULT NULL,
  `facturarinforme` tinyint(1) DEFAULT '0',
  `informefacturado` tinyint(1) DEFAULT '0',
  `nvaperdidadet` decimal(19,2) DEFAULT NULL,
  `nvaperdidaindemnizable` decimal(19,2) DEFAULT NULL,
  `faddendumrebaja` date DEFAULT NULL,
  `facturaraddendum1` tinyint(1) DEFAULT '0',
  `addendum1facturado` tinyint(1) DEFAULT '0',
  `nrofacturaaddedum1` bigint(16) DEFAULT '0',
  `ffacturaaddendum1` date DEFAULT NULL,
  `frecepaddendum1` date DEFAULT NULL,
  `fimpugaddendum1` date DEFAULT NULL,
  `frespimpugaddendum1` date DEFAULT NULL,
  `obsimpugaddendum1` text,
  `frecepaddendum2` date DEFAULT NULL,
  `facturaraddendum2` tinyint(1) DEFAULT '0',
  `addendum2facturado` tinyint(1) DEFAULT '0',
  `nrofacturaaddendum2` bigint(16) DEFAULT '0',
  `montofacturaaddendum2` bigint(16) DEFAULT '0',
  `ffacturaaddendum2` date DEFAULT NULL,
  `solucion` text,
  `cartaenviopresupuesto` tinyint(1) DEFAULT '0',
  `cartarecepinfliq` tinyint(1) DEFAULT '0',
  `captador` varchar(255) DEFAULT '',
  `quienenvioppto` varchar(255) DEFAULT '',
  `comunadelcaso` varchar(255) DEFAULT '',
  `provinciadelcaso` varchar(255) DEFAULT '',
  `regiondelcaso` varchar(255) DEFAULT '',
  `montopresupuesto` bigint(64) DEFAULT '0',
  `valorfactura` bigint(64) DEFAULT '0',
  `montofacturaaddendum1` bigint(64) DEFAULT '0',
  `valorufestimado` bigint(64) DEFAULT '0',
  `nombrecliente` int(11) unsigned DEFAULT '0',
  `fedoprogreso` date DEFAULT NULL,
  `fedoliqasig` date DEFAULT NULL,
  `fedovisprog` date DEFAULT NULL,
  `fedovisreal` date DEFAULT NULL,
  `fedoesperando` date DEFAULT NULL,
  `edocomercialasesor` varchar(255) DEFAULT '',
  `montoesperado` decimal(22,8) DEFAULT NULL,
  `montoesperadofirma` decimal(22,8) DEFAULT NULL,
  `montoesperadovisita` decimal(22,8) DEFAULT NULL,
  `firmapagada` tinyint(1) DEFAULT '0',
  `convisitapagada` tinyint(1) DEFAULT '0',
  `fpagofirma` date DEFAULT NULL,
  `fpagovisitaasesor` date DEFAULT NULL,
  `montototalrecibido` decimal(22,8) DEFAULT NULL,
  `obsdelsistema` text,
  `descontado` tinyint(1) DEFAULT '0',
  `fdescuento` date DEFAULT NULL,
  `indemnizacion` bigint(64) DEFAULT '0',
  `valoruf` decimal(62,2) DEFAULT NULL,
  `rechazocia` tinyint(1) DEFAULT '0',
  `montoaddendum1` decimal(65,2) DEFAULT NULL,
  `montoaddendum2` decimal(22,2) DEFAULT NULL,
  `pertenecealgrupo` varchar(255) DEFAULT '',
  `rechazoliqcob` tinyint(1) DEFAULT '0',
  `clasificadodemanda` tinyint(1) DEFAULT '0',
  `fclasificaciondemanda` date DEFAULT NULL,
  `gestionardemanda` tinyint(1) DEFAULT '0',
  `fgestionardemanda` date DEFAULT NULL,
  `bancopago` varchar(255) DEFAULT '',
  `tipopago` varchar(255) DEFAULT '',
  `cartaresolucion` tinyint(1) DEFAULT '0',
  `freccartares` date DEFAULT NULL,
  `conpago` tinyint(1) DEFAULT '0',
  `tipoinspeccion` varchar(255) DEFAULT '',
  `cargofijo` tinyint(1) DEFAULT '0',
  `facurarcf` tinyint(1) DEFAULT '0',
  `descuentocf` tinyint(1) DEFAULT '0',
  `facturadocf` tinyint(1) DEFAULT '0',
  `fpreinsp` date DEFAULT NULL,
  `evalpreinsp` varchar(255) DEFAULT '',
  `preinsprealizada` tinyint(1) DEFAULT '0',
  `presupuestopreinsprecibido` tinyint(1) DEFAULT '0',
  `fpresrecpreinsp` date DEFAULT NULL,
  `prespreinsprevisado` tinyint(1) DEFAULT '0',
  `frevpresupuestopreinsp` date DEFAULT NULL,
  `inicoberpoliza` date DEFAULT NULL,
  `fincoberpoliza` date DEFAULT NULL,
  `rutciaseguros` varchar(255) DEFAULT '',
  `direccionciaseguros` varchar(255) DEFAULT '',
  `nreprelegal` varchar(255) DEFAULT '',
  `antigpropiedad` varchar(255) DEFAULT '',
  `enviocertinsp` tinyint(1) DEFAULT '0',
  `fentregacarta` date DEFAULT NULL,
  `fconocimientodanos` date DEFAULT NULL,
  `cobertura` varchar(255) DEFAULT '',
  `pago` varchar(255) DEFAULT '',
  `deducible` varchar(255) DEFAULT '',
  `fueraplazo` tinyint(1) DEFAULT '0',
  `nexocausal` tinyint(1) DEFAULT '0',
  `sindano` tinyint(1) DEFAULT '0',
  `obsanalisis` text,
  `gestionprevia` tinyint(1) DEFAULT '0',
  `cobertura2` varchar(255) DEFAULT '',
  `deducible2` varchar(255) DEFAULT '',
  `causalesmixtas` varchar(255) DEFAULT '',
  `objsincobmix` text,
  `objconcob` text,
  `objsincobpur` text,
  `indemaddendum1` bigint(24) DEFAULT '0',
  `facturaaddendumpagada1` tinyint(1) DEFAULT '0',
  `fvenfacturaaddendum1` date DEFAULT NULL,
  `fpagofacturaaddendum1` date DEFAULT NULL,
  `bancopagoaddendum1` varchar(255) DEFAULT '',
  `tipopagoaddendum1` varchar(255) DEFAULT '',
  `asesorseguros` tinyint(1) DEFAULT '0',
  `fsismo_nuevo` varchar(255) DEFAULT '',
  `obspreinforme` text,
  `lugarsismo` varchar(255) DEFAULT '',
  `cobertura3` varchar(255) DEFAULT '',
  `deducible3` varchar(255) DEFAULT '',
  `causalesmixtas2` varchar(255) DEFAULT '',
  `objsincobmix2` text,
  `objconcob2` text,
  `objsincobpur2` text,
  `obsinformefin` text,
  `foliocontrato` int(6) DEFAULT '0',
  `captadorfree` varchar(255) DEFAULT '',
  `pagofreelance` tinyint(1) DEFAULT '0',
  `gestcorredorreccob` tinyint(1) DEFAULT '0',
  `gestcorredorotros` tinyint(1) DEFAULT '0',
  `mandtomconfir` tinyint(1) DEFAULT '0',
  `corr_seg` varchar(255) DEFAULT '',
  `gest_ext` varchar(255) DEFAULT '',
  `imp_comp` tinyint(1) DEFAULT '0',
  `fecha_rec_imp_comp` date DEFAULT NULL,
  `resp_imp_comp` tinyint(1) DEFAULT '0',
  `fech_resp_imp_comp` date DEFAULT NULL,
  `tip_rec` varchar(255) DEFAULT '',
  `obs_ase_leg` varchar(25) DEFAULT '',
  `est_liq` varchar(255) DEFAULT '',
  `cau_as_le` text,
  `noaplicacobroseguro` tinyint(1) DEFAULT '0',
  `crearddacom` tinyint(1) DEFAULT '0',
  `crearddacober` tinyint(1) DEFAULT '0',
  `perdrecuperableuf` decimal(8,2) DEFAULT NULL,
  `perdrecuperablepesos` int(10) DEFAULT '0',
  `plazoinfliq` date DEFAULT NULL,
  `desctoas` tinyint(1) DEFAULT '0',
  `tipodesctoas` varchar(30) DEFAULT '',
  `idsiniestroreporte` int(15) DEFAULT NULL,
  `idclientereporte` int(15) DEFAULT NULL,
  `idgestddareporte` int(15) DEFAULT NULL,
  `razonnoaplica` varchar(255) DEFAULT '',
  `comisionpagada` tinyint(1) DEFAULT '0',
  `fechapagocomision` date DEFAULT NULL,
  `valorplan` varchar(255) DEFAULT '',
  `interesadodda` tinyint(1) DEFAULT '0',
  `indadddos` bigint(30) DEFAULT '0',
  `fechaimpgadddos` date DEFAULT NULL,
  `obsimpgadddos` varchar(120) DEFAULT '',
  `fecharespuestaimpudos` date DEFAULT NULL,
  `factadddospag` tinyint(1) DEFAULT '0',
  `fechavenfactadddos` date DEFAULT NULL,
  `fechapagfactadddos` date DEFAULT NULL,
  `bancopagoadddos` varchar(60) DEFAULT '',
  `tipodepagoadddos` varchar(60) DEFAULT '',
  `contratofirmado2` tinyint(1) DEFAULT '0',
  `contratofirmado3` tinyint(1) NOT NULL DEFAULT '0',
  `hora_preinspeccion` time DEFAULT NULL,
  `hravisita` time DEFAULT NULL,
  `correorecpre` tinyint(1) DEFAULT '0',
  `correorecvisliq` tinyint(1) DEFAULT '0',
  `ddaingresada` tinyint(1) DEFAULT '0',
  `docenplataforma` tinyint(1) DEFAULT '0',
  `comentcontrato` text,
  `abonopagado` tinyint(1) DEFAULT '0',
  `fechaintento1` date DEFAULT NULL,
  `fechaintento2` date DEFAULT NULL,
  `fechaintento3` date DEFAULT NULL,
  `comentariabono` text,
  `mandatoenplata` tinyint(1) DEFAULT '0',
  `fechamandayotrosfirma` date DEFAULT NULL,
  `fonoanalista` varchar(25) DEFAULT '',
  `estado_pf` tinyint(1) DEFAULT '0',
  `descargadoc` varchar(255) DEFAULT '',
  `rut` varchar(30) DEFAULT '',
  `nuevocriterioct` tinyint(1) DEFAULT '0',
  `porcentajepago` int(3) DEFAULT '0',
  `ddaliquidador` tinyint(1) DEFAULT '0',
  `crearvtadda` tinyint(1) DEFAULT '0',
  `comentaripre` text,
  `fechaavisopre` date DEFAULT NULL,
  `fechaavisopretres` date DEFAULT NULL,
  `fechaavisovisita` date DEFAULT NULL,
  `fechaavisotres` date DEFAULT NULL,
  `solcontact` varchar(255) DEFAULT '',
  `estadollamadauno` varchar(255) DEFAULT '',
  `estadollamadados` varchar(255) DEFAULT '',
  `estadollamadatres` varchar(255) DEFAULT '',
  `fechallamadauno` date DEFAULT NULL,
  `fechallamadados` date DEFAULT NULL,
  `fechallamadatres` date DEFAULT NULL,
  `obsllamada` text,
  `contactowsp` tinyint(1) DEFAULT '0',
  `enviocorreoregllamada` tinyint(1) DEFAULT '0',
  `diavolverallamar` date DEFAULT NULL,
  `horavolverllamar` time DEFAULT NULL,
  `fechacontactowsp` date DEFAULT NULL,
  `nroreprogramacion` varchar(255) DEFAULT '',
  `estadoreprogramacion` varchar(255) DEFAULT '',
  `fechapreinsp` date DEFAULT NULL,
  `evapre` varchar(255) DEFAULT '',
  `ex_captador` varchar(100) DEFAULT '',
  `arrendatario` varchar(100) DEFAULT '',
  `reprogramadosos` tinyint(1) DEFAULT '0',
  `estadossos` varchar(255) DEFAULT '',
  `retencionventas` varchar(255) DEFAULT '',
  `reas` int(1) NOT NULL DEFAULT '0',
  `estadoprogreso` varchar(255) DEFAULT '',
  `mandatofirmado` tinyint(1) DEFAULT '0',
  `descargarmandato` varchar(255) DEFAULT '',
  `tomadeconocimiento` tinyint(1) DEFAULT '0',
  `descargartomadeconocimiento` varchar(255) DEFAULT '',
  `declaracionjuradafirmada` tinyint(1) DEFAULT '0',
  `descargardeclaracionjurada` varchar(255) DEFAULT '',
  `certificadodeinspeccionfirmado` tinyint(1) DEFAULT '0',
  `descargarcertificadoinspeccion` varchar(255) DEFAULT '',
  `ftomadeconocimiento` date DEFAULT NULL,
  `estado_pf_tc` tinyint(1) DEFAULT '0',
  `fechacertificadoinspeccion` date DEFAULT NULL,
  `fechadecalracionjurada` date DEFAULT NULL,
  `fechamandatofirmado` date DEFAULT NULL,
  `obscasoesp` text,
  `volverallamar` tinyint(1) DEFAULT '0',
  `fechavolverallamar` date DEFAULT NULL,
  `obsvolverallamar` text,
  `id_fact_relBase_sus` varchar(200) DEFAULT '0',
  `estado_factura_sii` varchar(200) NOT NULL,
  `fecha_siniestro` date DEFAULT NULL,
  `id_fact_relBase_hono` varchar(200) NOT NULL DEFAULT '0',
  `razongestionarprogreso` varchar(255) DEFAULT '',
  `ffacturapagada` tinyint(1) DEFAULT '0',
  `nombrearrendatario` varchar(200) DEFAULT '',
  `telefonoarrendatario` varchar(200) DEFAULT '',
  `conarrendatario` tinyint(1) DEFAULT '0',
  `id_fact_relbase_hono_adendum` varchar(100) DEFAULT '0',
  `latitud_sini` varchar(100) DEFAULT '',
  `longitud_sini` varchar(100) DEFAULT '',
  `georeferenciado_estado` tinyint(1) DEFAULT '0',
  `nronotacredito` varchar(30) DEFAULT '',
  `evasig_pre_ins_ins` varchar(100) DEFAULT '',
  `hravisita_pre_ins_ins` time DEFAULT NULL,
  `nom_isnpec_pre_ins_ins` varchar(100) DEFAULT '',
  `obs_pre_ins_ins` varchar(100) DEFAULT '',
  `faviso_pre_ins_ins` date DEFAULT NULL,
  `favisovisita3dias_pre_ins_ins` date DEFAULT NULL,
  `progra_pre_ins_ins` tinyint(1) DEFAULT '0',
  `fvisita_pre_ins_ins` date DEFAULT NULL,
  `facta_pre_ins_ins` date DEFAULT NULL,
  `coor_completa` varchar(200) DEFAULT '',
  `confirmapreinspeccion` tinyint(1) DEFAULT '0',
  `confirmainspeccion` tinyint(1) DEFAULT '0',
  `mark_provisoria` int(11) NOT NULL,
  `clienteinformado` tinyint(1) DEFAULT '0',
  `fechaclinfo` date DEFAULT NULL,
  `obsclinformado` text,
  `solparagestionarprogreso` varchar(255) DEFAULT '',
  `rangohorpre` varchar(255) DEFAULT '',
  `diasdisppre` text,
  `fonoinspector` varchar(50) DEFAULT '',
  `mailinspector` varchar(50) DEFAULT '',
  `asociadoesterno` varchar(255) DEFAULT '',
  `canalcaptacion` varchar(255) DEFAULT '',
  `creadaaslegal` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`siniestroid`),
  KEY `vtiger_siniestro_pp_nombrecliente_idx` (`nombrecliente`),
  CONSTRAINT `fk_1_vtiger_siniestro_ppsiniestroid` FOREIGN KEY (`siniestroid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_smsnotifier`;
CREATE TABLE `vtiger_smsnotifier` (
  `smsnotifierid` int(10) NOT NULL,
  `message` text,
  `smsnotifier_status` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`smsnotifierid`),
  CONSTRAINT `vtiger_smsnotifier_ibfk_1` FOREIGN KEY (`smsnotifierid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_solicituddecredito`;
CREATE TABLE `vtiger_solicituddecredito` (
  `solicituddecreditoid` int(11) NOT NULL DEFAULT '0',
  `solicitud_credito` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `nombrecredito` varchar(32) DEFAULT '',
  `apellido` varchar(32) DEFAULT '',
  `fnacimiento` date DEFAULT NULL,
  `edocivil` varchar(255) DEFAULT '',
  `nrodctocredito` varchar(16) DEFAULT '',
  `emailcredito` varchar(100) DEFAULT '',
  `estudioscredito` varchar(255) DEFAULT '',
  `profcredito` varchar(32) DEFAULT '',
  `marca` varchar(255) DEFAULT '',
  `modelo` varchar(16) DEFAULT '',
  `nuevousado` varchar(255) DEFAULT '',
  `acreditacionpie` varchar(255) DEFAULT '',
  `patente` varchar(16) DEFAULT '',
  `fonoreferencia1_extra` varchar(100) DEFAULT NULL,
  `fonoreferencia2_extra` varchar(100) DEFAULT NULL,
  `rutempleador` varchar(16) DEFAULT '',
  `tipoempleado` varchar(255) DEFAULT '',
  `fonocomercio_extra` varchar(100) DEFAULT NULL,
  `fingreso` date DEFAULT NULL,
  `dondeotrosingresos` text,
  `banco` varchar(255) DEFAULT '',
  `nombreconyugue` varchar(32) DEFAULT '',
  `apellidoconyugue` varchar(32) DEFAULT '',
  `movilconyugue` varchar(30) DEFAULT '',
  `movilconyugue_extra` varchar(100) DEFAULT NULL,
  `rutconyugue` varchar(16) DEFAULT '',
  `bieninmueble1` varchar(255) DEFAULT '',
  `dirbieninmueble1` text,
  `bieninmueble2` varchar(255) DEFAULT '',
  `dirbieninmueble2` text,
  `deudainmueble2` varchar(255) DEFAULT '',
  `deudabieninmueble1` varchar(255) DEFAULT '',
  `automovil1` varchar(255) DEFAULT '',
  `modeloauto1` varchar(8) DEFAULT '',
  `patenteauto1` varchar(8) DEFAULT '',
  `automovil2` varchar(255) DEFAULT '',
  `modeloauto2` varchar(8) DEFAULT '',
  `patenteauto2` varchar(8) DEFAULT '',
  `prendaauto2` varchar(255) DEFAULT '',
  `movilcliente_extra` varchar(100) DEFAULT NULL,
  `tlfcliente_extra` varchar(100) DEFAULT NULL,
  `movil` varchar(30) DEFAULT '',
  `movil_extra` varchar(100) DEFAULT NULL,
  `tlfparticular` varchar(30) DEFAULT '',
  `tlfparticular_extra` varchar(100) DEFAULT NULL,
  `direccion` text,
  `nreferencia1` varchar(16) DEFAULT '',
  `fonoreferencia1` varchar(30) DEFAULT '',
  `parentezcoreferencia1` varchar(255) DEFAULT '',
  `fonoreferencia2` varchar(30) DEFAULT '',
  `parentezcoreferencia2` varchar(255) DEFAULT '',
  `direccionempleador` text,
  `fonoempleador` varchar(30) DEFAULT '',
  `fonoempleador_extra` varchar(100) DEFAULT NULL,
  `cuentacorriente` tinyint(1) DEFAULT '0',
  `antiguedad` varchar(255) DEFAULT '',
  `tipoempleadoconyugue` varchar(255) DEFAULT '',
  `fingresoconyugue` date DEFAULT NULL,
  `nempleadorconyugue` varchar(16) DEFAULT '',
  `frechazoaprobacion` date DEFAULT NULL,
  `prendaauto1` varchar(255) DEFAULT '',
  `posibilidad` decimal(5,2) DEFAULT NULL,
  `pais` varchar(255) DEFAULT '',
  `apellidoreferencia1` varchar(32) DEFAULT '',
  `nreferencia2` varchar(32) DEFAULT '',
  `apellidoreferencia2` varchar(32) DEFAULT '',
  `edosolcredito` varchar(255) DEFAULT '',
  `region` varchar(255) DEFAULT '',
  `comunaempleador` varchar(255) DEFAULT '',
  `provinciaempleador` varchar(255) DEFAULT '',
  `regionempleador` varchar(255) DEFAULT '',
  `comunacli` varchar(255) DEFAULT '',
  `provinciacli` varchar(255) DEFAULT '',
  `comunabi1` varchar(255) DEFAULT '',
  `comunabi2` varchar(255) DEFAULT '',
  `provinciabi1` varchar(255) DEFAULT '',
  `regionbi1` varchar(255) DEFAULT '',
  `provinciabi2` varchar(255) DEFAULT '',
  `regionbi2` varchar(255) DEFAULT '',
  `cargo` varchar(64) DEFAULT '',
  `cargoconyugue` varchar(64) DEFAULT '',
  `nrosolicitud` varchar(64) DEFAULT '',
  `anovehiculo` varchar(255) DEFAULT '',
  `plazopa` varchar(255) DEFAULT '',
  `nroindexa` varchar(32) DEFAULT '',
  `edad` int(8) DEFAULT '0',
  `nroprotesto` int(8) DEFAULT '0',
  `tasapiso` decimal(5,2) DEFAULT NULL,
  `tasatecho` decimal(5,2) DEFAULT NULL,
  `cae` decimal(5,2) DEFAULT NULL,
  `comisionporciento` decimal(5,2) DEFAULT NULL,
  `preaprobado` tinyint(1) DEFAULT '0',
  `obssistema` text,
  `obsasesor` text,
  `obssupervisor` text,
  `checkmorosidad` tinyint(1) DEFAULT '0',
  `antlaboral` int(8) DEFAULT '0',
  `propiedad` varchar(255) DEFAULT '',
  `valorpie` varchar(255) DEFAULT '',
  `valorpieneto` decimal(65,8) DEFAULT NULL,
  `actividad` varchar(64) DEFAULT '',
  `valorvehiculo` decimal(65,8) DEFAULT NULL,
  `nempleador` varchar(64) DEFAULT '',
  `rentaliquida` decimal(65,8) DEFAULT NULL,
  `pensionjubilacion` decimal(65,8) DEFAULT NULL,
  `arriendobiener` decimal(65,8) DEFAULT NULL,
  `honorarios` decimal(65,8) DEFAULT NULL,
  `otrosingresos` decimal(65,8) DEFAULT NULL,
  `lineacredito` decimal(65,8) DEFAULT NULL,
  `totalingresos` decimal(65,8) DEFAULT NULL,
  `montototalprotesto` decimal(65,8) DEFAULT NULL,
  `valorcomercialbi1` decimal(65,8) DEFAULT NULL,
  `valorcomercialbi2` decimal(65,8) DEFAULT NULL,
  `valorcomercialbm1` decimal(65,8) DEFAULT NULL,
  `valorcomercialbm2` decimal(65,8) DEFAULT NULL,
  `valorcuota` decimal(65,8) DEFAULT NULL,
  `ctc` decimal(65,8) DEFAULT NULL,
  `comision` decimal(65,8) DEFAULT NULL,
  `alzamientoprenda` decimal(65,8) DEFAULT NULL,
  `constitucionprenda` decimal(65,8) DEFAULT NULL,
  `legalizacionpagare` decimal(65,8) DEFAULT NULL,
  `gastosadministrativos` decimal(65,8) DEFAULT NULL,
  `retirodocumentos` decimal(65,8) DEFAULT NULL,
  `montoafinanciar` decimal(65,8) DEFAULT NULL,
  `segurocesantia` decimal(65,8) DEFAULT NULL,
  `impuestopagare` decimal(5,2) DEFAULT NULL,
  `montopagare` decimal(65,8) DEFAULT NULL,
  `rentaliquidaconyugue` decimal(65,8) DEFAULT NULL,
  PRIMARY KEY (`solicituddecreditoid`),
  CONSTRAINT `fk_1_vtiger_solicituddecreditosolicituddecreditoid` FOREIGN KEY (`solicituddecreditoid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_solitudsiniestros`;
CREATE TABLE `vtiger_solitudsiniestros` (
  `solitudsiniestrosid` int(11) NOT NULL DEFAULT '0',
  `number` varchar(32) DEFAULT NULL,
  `nombres` varchar(16) DEFAULT '',
  `apellidos` varchar(16) DEFAULT '',
  `rut` varchar(8) DEFAULT '',
  `edocivil` varchar(255) DEFAULT '',
  `nacionalidad` varchar(8) DEFAULT '',
  `email` varchar(100) DEFAULT '',
  `movil` varchar(30) DEFAULT '',
  `movil_extra` varchar(100) DEFAULT NULL,
  `tlfparticular` varchar(30) DEFAULT '',
  `tlfparticular_extra` varchar(100) DEFAULT NULL,
  `tiposiniestro` varchar(255) DEFAULT '',
  `tipopropiedad` varchar(255) DEFAULT '',
  `banco` varchar(255) DEFAULT '',
  `ciaseguros` varchar(255) DEFAULT '',
  `mts2` decimal(11,2) DEFAULT NULL,
  `observaciones` text,
  `direccion` text,
  `dircaso` text,
  `nrodctoss` varchar(32) DEFAULT '',
  `profesion` varchar(32) DEFAULT '',
  `comunacli` varchar(255) DEFAULT '',
  `provinciacli` varchar(255) DEFAULT '',
  `regioncli` varchar(255) DEFAULT '',
  `comunadelcaso` varchar(255) DEFAULT '',
  `provinciadelcaso` varchar(255) DEFAULT '',
  `regiondelcaso` varchar(255) DEFAULT '',
  `valorufaproximado` bigint(64) DEFAULT '0',
  `nrosolicitud` varchar(64) DEFAULT '',
  `edosolicitud` varchar(255) DEFAULT '',
  PRIMARY KEY (`solitudsiniestrosid`),
  CONSTRAINT `fk_1_vtiger_solitudsiniestrossolitudsiniestrosid` FOREIGN KEY (`solitudsiniestrosid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subidadocumentos`;
CREATE TABLE `vtiger_subidadocumentos` (
  `subidadocumentosid` int(11) NOT NULL,
  `subidadocs` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `idsiniestro` int(11) unsigned DEFAULT '0',
  `idcliente` int(11) unsigned DEFAULT '0',
  `tipodoc` varchar(50) DEFAULT '',
  `descargardoc` varchar(255) DEFAULT '',
  PRIMARY KEY (`subidadocumentosid`),
  KEY `vtiger_subidadocumentos_idsiniestro_idx` (`idsiniestro`),
  KEY `vtiger_subidadocumentos_idcliente_idx` (`idcliente`),
  CONSTRAINT `fk_1_vtiger_subidadocumentossubidadocumentosid` FOREIGN KEY (`subidadocumentosid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripcion`;
CREATE TABLE `vtiger_suscripcion` (
  `suscripcionid` int(11) NOT NULL DEFAULT '0',
  `valortotal` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `siniestro` int(11) unsigned DEFAULT '0',
  `valorcuota` bigint(16) DEFAULT '0',
  `banco` varchar(255) DEFAULT '',
  `nrocuenta` bigint(64) DEFAULT '0',
  `tipocuenta` varchar(255) DEFAULT '',
  `sucursal` varchar(59) DEFAULT '',
  `diaspago` varchar(255) DEFAULT '',
  `nrocuotas` varchar(255) DEFAULT '',
  `abono` bigint(59) DEFAULT '0',
  `ven1cuota` date DEFAULT NULL,
  `nrofactura` bigint(32) DEFAULT '0',
  `ffactura` date DEFAULT NULL,
  `facturapagada` tinyint(1) DEFAULT '0',
  `ffacturapagada` date DEFAULT NULL,
  `primeracuota` bigint(32) DEFAULT '0',
  `1cuotapagada` tinyint(1) DEFAULT '0',
  `tpago1cuota` varchar(255) DEFAULT '',
  `fven1` date DEFAULT NULL,
  `f1cuotapagada` date DEFAULT NULL,
  `bdpago1cuota` varchar(255) DEFAULT '',
  `segundacuota` bigint(32) DEFAULT '0',
  `2cuotapagada` tinyint(1) DEFAULT '0',
  `tpago2cuota` varchar(255) DEFAULT '',
  `fven2` date DEFAULT NULL,
  `f2cuotapagada` date DEFAULT NULL,
  `bdpago2cuota` varchar(255) DEFAULT '',
  `abonopagado` tinyint(1) DEFAULT '0',
  `fpagoabono` date DEFAULT NULL,
  `tpagoabono` varchar(255) DEFAULT '',
  `bdpago` varchar(255) DEFAULT '',
  `captador` varchar(255) DEFAULT '',
  `nombrecliente` int(11) unsigned DEFAULT '0',
  `fechadelabono` date DEFAULT NULL,
  `codwebpayabono` bigint(12) DEFAULT '0',
  `codwebpaycuota1` bigint(12) DEFAULT '0',
  `codwebpaycuota2` varchar(12) DEFAULT '',
  `tarjpagoabono` varchar(255) DEFAULT '',
  `tarjpagocuota1` varchar(255) DEFAULT '',
  `tarjpagocuota2` varchar(255) DEFAULT '',
  `matclayabo` tinyint(1) DEFAULT '0',
  `matclayuno` tinyint(1) DEFAULT '0',
  `matchclaydos` tinyint(1) DEFAULT '0',
  `c_abono` int(11) NOT NULL DEFAULT '0',
  `c_c1` int(11) NOT NULL DEFAULT '1',
  `c_c2` int(11) NOT NULL DEFAULT '2',
  `pagadapornc` varchar(50) DEFAULT '',
  `devolucionrealizada` tinyint(1) DEFAULT '0',
  `fechapagodevolucion` date DEFAULT NULL,
  `notacredito` tinyint(1) DEFAULT '0',
  `numerocredito` varchar(50) DEFAULT '',
  `fechavenabo` date DEFAULT NULL,
  `actualizarvencuotas` tinyint(1) DEFAULT '0',
  `estadosus` varchar(255) DEFAULT '',
  `fechallamadauno` date DEFAULT NULL,
  `fechallamadados` date DEFAULT NULL,
  `fechallamadatres` date DEFAULT NULL,
  `estadollamadauno` varchar(255) DEFAULT '',
  `estadollamadados` varchar(255) DEFAULT '',
  `estadollamadatres` varchar(255) DEFAULT '',
  `obs` varchar(255) DEFAULT '',
  `fechapagocompro` date DEFAULT NULL,
  `estado` varchar(255) DEFAULT '',
  `montopresupuesto` bigint(40) DEFAULT '0',
  `abonovencido` tinyint(1) DEFAULT '0',
  `correocliente` varchar(50) DEFAULT '',
  `sinacofi` tinyint(1) DEFAULT '0',
  `paymentsinid` int(11) unsigned DEFAULT '0',
  `contratofirmado` tinyint(1) DEFAULT '0',
  `fechacargopacabono` date DEFAULT NULL,
  `fechaabonofintocabono` date DEFAULT NULL,
  `fechacargopaccuota1` date DEFAULT NULL,
  `fechaabonofintoccuota1` date DEFAULT NULL,
  `fechacargopaccuota2` date DEFAULT NULL,
  `fechaabonofintoccuota2` date DEFAULT NULL,
  `obssus` varchar(200) DEFAULT '',
  `observacion_pago_abono` text,
  `observacion_pago_primera_cuota` text,
  `observacion_pago_segunda_cuota` text,
  `asociadoesterno` varchar(200) DEFAULT '',
  `id_customer_toku` varchar(200) DEFAULT '',
  `id_sub_toku` varchar(200) DEFAULT '',
  PRIMARY KEY (`suscripcionid`),
  KEY `vtiger_suscripcion_siniestro_idx` (`siniestro`),
  KEY `vtiger_suscripcion_nombrecliente_idx` (`nombrecliente`),
  KEY `vtiger_suscripcion_paymentsinid_idx` (`paymentsinid`),
  CONSTRAINT `fk_1_vtiger_suscripcionsuscripcionid` FOREIGN KEY (`suscripcionid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripciondda`;
CREATE TABLE `vtiger_suscripciondda` (
  `suscripcionddaid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `idventademanda` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`suscripcionddaid`),
  KEY `vtiger_suscripciondda_idventademanda_idx` (`idventademanda`),
  CONSTRAINT `fk_1_vtiger_suscripcionddasuscripcionddaid` FOREIGN KEY (`suscripcionddaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripciondemanda`;
CREATE TABLE `vtiger_suscripciondemanda` (
  `suscripciondemandaid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `rutcliente` varchar(30) DEFAULT '',
  `estadocaso` varchar(100) DEFAULT '',
  `estadocomercialdda` varchar(100) DEFAULT '',
  `valorplan` bigint(100) DEFAULT '0',
  `valorcuotas` bigint(100) DEFAULT '0',
  `nrofactura` varchar(100) DEFAULT '',
  `notacredito` tinyint(1) DEFAULT '0',
  `nronotacredito` varchar(100) DEFAULT '',
  `cuotaunoddapagada` tinyint(1) DEFAULT '0',
  `valorcuota1dda` bigint(100) DEFAULT '0',
  `fechacuotaunopagada` date DEFAULT NULL,
  `fechavencimientocuotauno` date DEFAULT NULL,
  `valorcuotadosdda` bigint(100) DEFAULT '0',
  `fechacuotadospagada` date DEFAULT NULL,
  `fechavencimientocuotados` date DEFAULT NULL,
  `cuotadospagada` tinyint(1) DEFAULT '0',
  `matchclaycuotauno` tinyint(1) DEFAULT '0',
  `matchclaycuotados` tinyint(1) DEFAULT '0',
  `bancopagocuotauno` varchar(255) DEFAULT '',
  `bacnodepagocuotados` varchar(255) DEFAULT '',
  `tipodepagocuotauno` varchar(255) DEFAULT '',
  `tipodepagocuotados` varchar(255) DEFAULT '',
  `estadosuscripcion` varchar(255) DEFAULT '',
  `fechapagocompro` date DEFAULT NULL,
  `estadollamadauno` varchar(255) DEFAULT '',
  `fechallamadauno` date DEFAULT NULL,
  `estadollamadados` varchar(255) DEFAULT '',
  `fechallamadados` date DEFAULT NULL,
  `estadollamadatres` varchar(255) DEFAULT '',
  `fechallamadatres` date DEFAULT NULL,
  `nrocuotas` varchar(255) DEFAULT '',
  `cuotatrespagada` tinyint(1) DEFAULT '0',
  `valorcuotatresdda` bigint(20) DEFAULT '0',
  `fechacuotatrespagada` date DEFAULT NULL,
  `fechavencimientocuotatres` date DEFAULT NULL,
  `matchclaycuotatres` tinyint(1) DEFAULT '0',
  `bancodepagocuotatres` varchar(255) DEFAULT '',
  `tipodepagocuotatres` varchar(255) DEFAULT '',
  `actualizar` tinyint(1) DEFAULT '0',
  `observaciones` text,
  `facturasusddapagada` tinyint(1) DEFAULT '0',
  `susfacturada` tinyint(1) DEFAULT '0',
  `fechaemifact` date DEFAULT NULL,
  `idventadedemanda` int(11) unsigned DEFAULT '0',
  `clienteid` int(11) unsigned DEFAULT '0',
  `siniestroid` int(11) unsigned DEFAULT '0',
  `agregadolistadda` tinyint(1) DEFAULT '0',
  `id_relbase` varchar(100) NOT NULL DEFAULT '0',
  `tipoplan` varchar(255) DEFAULT '',
  `observaciones_gestion` text,
  `observaciones_cuota_n1` varchar(120) DEFAULT '',
  `observaciones_cuota_n2` varchar(120) DEFAULT '',
  `observaciones_cuota_n3` varchar(120) DEFAULT '',
  `planaslegal` varchar(255) DEFAULT '',
  `id_customer_toku` varchar(200) DEFAULT '',
  `id_sub_toku` varchar(200) DEFAULT '',
  PRIMARY KEY (`suscripciondemandaid`),
  KEY `vtiger_suscripciondemanda_idventadedemanda_idx` (`idventadedemanda`),
  KEY `vtiger_suscripciondemanda_clienteid_idx` (`clienteid`),
  KEY `vtiger_suscripciondemanda_siniestroid_idx` (`siniestroid`),
  CONSTRAINT `fk_1_vtiger_suscripciondemandasuscripciondemandaid` FOREIGN KEY (`suscripciondemandaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_troubletickets`;
CREATE TABLE `vtiger_troubletickets` (
  `ticketid` int(10) NOT NULL,
  `ticket_no` varchar(100) NOT NULL,
  `groupname` varchar(100) DEFAULT NULL,
  `parent_id` int(10) DEFAULT NULL,
  `product_id` int(10) DEFAULT NULL,
  `priority` varchar(200) DEFAULT NULL,
  `severity` varchar(200) DEFAULT NULL,
  `status` varchar(200) DEFAULT NULL,
  `category` varchar(200) DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `solution` text,
  `update_log` text,
  `version_id` int(10) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `servicecontractsid` int(10) DEFAULT NULL,
  `attention` text,
  `pssold_id` int(10) DEFAULT NULL,
  `ordertime` decimal(10,2) DEFAULT NULL,
  `from_portal` smallint(1) DEFAULT NULL,
  `contract_type` varchar(255) DEFAULT NULL,
  `contracts_end_date` date DEFAULT NULL,
  `report_time` int(10) DEFAULT NULL,
  `response_time` datetime DEFAULT NULL,
  PRIMARY KEY (`ticketid`),
  KEY `troubletickets_ticketid_idx` (`ticketid`),
  KEY `troubletickets_status_idx` (`status`),
  KEY `parent_id` (`parent_id`),
  KEY `product_id` (`product_id`),
  KEY `servicecontractsid` (`servicecontractsid`),
  KEY `pssold_id` (`pssold_id`),
  KEY `ticket_no` (`ticket_no`),
  CONSTRAINT `fk_1_vtiger_troubletickets` FOREIGN KEY (`ticketid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_vendor`;
CREATE TABLE `vtiger_vendor` (
  `vendorid` int(10) NOT NULL DEFAULT '0',
  `vendor_no` varchar(100) NOT NULL,
  `vendorname` varchar(100) DEFAULT NULL,
  `phone` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `glacct` varchar(200) DEFAULT NULL,
  `category` varchar(50) DEFAULT NULL,
  `description` text,
  `vat_id` varchar(30) DEFAULT NULL,
  `registration_number_1` varchar(30) DEFAULT NULL,
  `registration_number_2` varchar(30) DEFAULT NULL,
  `verification` text,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `active` tinyint(1) DEFAULT '0',
  `phone_extra` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`vendorid`),
  KEY `vendorname` (`vendorname`),
  CONSTRAINT `fk_1_vtiger_vendor` FOREIGN KEY (`vendorid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ventadedemandas`;
CREATE TABLE `vtiger_ventadedemandas` (
  `ventadedemandasid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `tiposiniestro` varchar(30) DEFAULT '',
  `direccionsiniestro` varchar(100) DEFAULT '',
  `comunasiniestro` varchar(100) DEFAULT '',
  `banco` varchar(100) DEFAULT '',
  `compseguros` varchar(100) DEFAULT '',
  `liquidador` varchar(100) DEFAULT '',
  `fechacreacioncaso` date DEFAULT NULL,
  `fechadenuncia` date DEFAULT NULL,
  `fechavisita` date DEFAULT NULL,
  `fechapresupuesto` date DEFAULT NULL,
  `fechainforme` date DEFAULT NULL,
  `fechaimpug` date DEFAULT NULL,
  `fecharesp` date DEFAULT NULL,
  `fechapreinspeccion` date DEFAULT NULL,
  `porcentajeapagar` decimal(5,2) DEFAULT NULL,
  `contratofirmado` varchar(1) DEFAULT '0',
  `estadocobranza` varchar(100) DEFAULT '',
  `estadocomercialdda` varchar(255) DEFAULT '',
  `estadollamada` varchar(255) DEFAULT '',
  `captador` varchar(100) DEFAULT '',
  `obsllamada` text,
  `fechavolver` date DEFAULT NULL,
  `horavolver` time DEFAULT NULL,
  `rutcliente` varchar(100) DEFAULT '',
  `fono` varchar(100) DEFAULT '',
  `correo` varchar(100) DEFAULT '',
  `ddavendida` tinyint(1) DEFAULT '0',
  `ddarechazada` tinyint(1) DEFAULT '0',
  `correotentativo` tinyint(1) DEFAULT '0',
  `correonromalo` tinyint(1) DEFAULT '0',
  `idsiniestro` int(11) unsigned DEFAULT '0',
  `perdidareclamadauf` decimal(23,2) DEFAULT NULL,
  `perddetuf` decimal(23,2) DEFAULT NULL,
  `deducibleuf` decimal(23,2) DEFAULT NULL,
  `perdinduf` decimal(23,2) DEFAULT NULL,
  `indemnizacionclpclp` bigint(20) DEFAULT '0',
  `montorecuperarclp` bigint(20) DEFAULT '0',
  `actualizar` tinyint(1) DEFAULT '0',
  `estadocasosiniestro` varchar(100) DEFAULT '',
  `clienteid` int(11) unsigned DEFAULT '0',
  `fcontratofirmado` date DEFAULT NULL,
  `estado_pf` varchar(10) DEFAULT '',
  `descargadoc` varchar(255) DEFAULT '',
  `motivorechazovtadda` varchar(255) DEFAULT '',
  `cuotaunoddapagada` tinyint(1) DEFAULT '0',
  `crearsusdda` tinyint(1) DEFAULT '0',
  `susddafacturada` tinyint(1) DEFAULT '0',
  `paymentsinid` int(11) unsigned DEFAULT '0',
  `suscripcionid` int(11) unsigned DEFAULT '0',
  `pordemandar` tinyint(1) DEFAULT '0',
  `generardda` tinyint(1) DEFAULT '0',
  `fechaasignacion` date DEFAULT NULL,
  `comisionpagada` tinyint(1) DEFAULT '0',
  `categoriacomision` varchar(255) DEFAULT '',
  `agregadolistadda` tinyint(1) DEFAULT '0',
  `planaslegal` varchar(255) DEFAULT '',
  `pac_toku_monflow` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`ventadedemandasid`),
  KEY `vtiger_ventadedemandas_idsiniestro_idx` (`idsiniestro`),
  KEY `vtiger_ventadedemandas_clienteid_idx` (`clienteid`),
  KEY `vtiger_ventadedemandas_paymentsinid_idx` (`paymentsinid`),
  KEY `vtiger_ventadedemandas_suscripcionid_idx` (`suscripcionid`),
  CONSTRAINT `fk_1_vtiger_ventadedemandasventadedemandasid` FOREIGN KEY (`ventadedemandasid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ventademandas`;
CREATE TABLE `vtiger_ventademandas` (
  `ventademandasid` int(11) NOT NULL,
  `id` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `relacionsiniestro` int(11) unsigned DEFAULT '0',
  `montopresupuesto` bigint(15) DEFAULT '0',
  `tiposiniestro` varchar(30) DEFAULT '',
  `perdidadeterminadap` bigint(20) DEFAULT '0',
  `direccionsiniestro` varchar(40) DEFAULT '',
  `deducibleafectop` bigint(15) DEFAULT '0',
  `comunacaso` varchar(30) DEFAULT '',
  `perdidaindemnizablep` varchar(15) DEFAULT '',
  `ciudadcaso` varchar(40) DEFAULT '',
  `pagoporcentaje` decimal(5,2) DEFAULT NULL,
  `categorizacion` varchar(30) DEFAULT '',
  `montoporreclamarp` bigint(15) DEFAULT '0',
  `ciaseguros` varchar(40) DEFAULT '',
  `llamada` varchar(255) DEFAULT '',
  `volverllamar` tinyint(1) DEFAULT '0',
  `edogestion` varchar(255) DEFAULT '',
  `fvolverllamar` date DEFAULT NULL,
  `hvolverllamar` time DEFAULT NULL,
  `obsllamada` text,
  `casorevisado` tinyint(1) DEFAULT '0',
  `presupuestomanual` tinyint(1) DEFAULT '0',
  `descmand` tinyint(1) DEFAULT '0',
  `nombre` varchar(40) DEFAULT '',
  `apellido` varchar(40) DEFAULT '',
  `cliente` varchar(25) DEFAULT '',
  `serienrodocto` varchar(20) DEFAULT '',
  `movil` varchar(20) DEFAULT '',
  `email` varchar(40) DEFAULT '',
  `tlfparticular` varchar(30) DEFAULT '',
  `mailotro` varchar(30) DEFAULT '',
  `tlfotro` varchar(30) DEFAULT '',
  `observaciones` text,
  `edocivil` varchar(30) DEFAULT '',
  `profesion` varchar(40) DEFAULT '',
  `modificardatos` tinyint(1) DEFAULT '0',
  `comentariomodificacion` text,
  `banco` varchar(30) DEFAULT '',
  `entliquidadora` varchar(30) DEFAULT '',
  `fdenuncio` date DEFAULT NULL,
  `estado` varchar(30) DEFAULT '',
  `fvisita` date DEFAULT NULL,
  `fpresupuesto` date DEFAULT NULL,
  `frecinfliq` date DEFAULT NULL,
  `deducibleafecto` decimal(8,2) DEFAULT NULL,
  `perdidareclamada` decimal(8,2) DEFAULT NULL,
  `perdidadeterminada` decimal(8,2) DEFAULT NULL,
  `fimpugnacion` date DEFAULT NULL,
  `perdidaindemnizable` decimal(8,2) DEFAULT NULL,
  `frespimpugnacion` date DEFAULT NULL,
  `notificacionaceptacion` tinyint(1) DEFAULT '0',
  `notificacionrechazo` tinyint(1) DEFAULT '0',
  `notificacionemail` tinyint(1) DEFAULT '0',
  `mailinformativo` tinyint(1) DEFAULT '0',
  `mail_firmas` tinyint(1) DEFAULT '0',
  `dctosdec` tinyint(1) DEFAULT '0',
  `fdocdec` date DEFAULT NULL,
  `dctosfirmados` tinyint(1) DEFAULT '0',
  `fcontratofirmado` date DEFAULT NULL,
  `mandatofirmado` tinyint(1) DEFAULT '0',
  `fmandatofirmado` date DEFAULT NULL,
  `comentariocontrato` text,
  `costodemanda` bigint(20) DEFAULT '0',
  `fnegociacion` date DEFAULT NULL,
  `abono` bigint(20) DEFAULT '0',
  `fprimerpago` date DEFAULT NULL,
  `fabono0` date DEFAULT NULL,
  `nrofactura` varchar(20) DEFAULT '',
  `diapago` varchar(255) DEFAULT '',
  `ffactura` date DEFAULT NULL,
  `nrocuotasgd` varchar(255) DEFAULT '',
  `facturapagada` tinyint(1) DEFAULT '0',
  `valorcuota` bigint(20) DEFAULT '0',
  `ffacturapagada` date DEFAULT NULL,
  `deudarestante` bigint(20) DEFAULT '0',
  `fabono` date DEFAULT NULL,
  `nfacabono` varchar(30) DEFAULT '',
  `abonopagado` tinyint(1) DEFAULT '0',
  `tpagoabono` varchar(255) DEFAULT '',
  `fpagoabono` date DEFAULT NULL,
  `bdepago` varchar(255) DEFAULT '',
  `codwebpayabono` varchar(40) DEFAULT '',
  `tarjpagoabono` varchar(255) DEFAULT '',
  `valor1cuota` bigint(20) DEFAULT '0',
  `fcompromisocuota1` date DEFAULT NULL,
  `1cuotapagada` tinyint(1) DEFAULT '0',
  `f1cuota` date DEFAULT NULL,
  `tpago1cuota` varchar(255) DEFAULT '',
  `bdpago1cuota` varchar(255) DEFAULT '',
  `codwebpaycuota1` varchar(30) DEFAULT '',
  `tarjpagocuota1` varchar(255) DEFAULT '',
  `valor2cuota` bigint(20) DEFAULT '0',
  `fcompromisocuota2` date DEFAULT NULL,
  `2cuotapagada` tinyint(1) DEFAULT '0',
  `f2cuota` date DEFAULT NULL,
  `tpago2cuota` varchar(255) DEFAULT '',
  `bdpago2cuota` varchar(255) DEFAULT '',
  `codwebpaycuota2` varchar(30) DEFAULT '',
  `tarjpagocuota2` varchar(255) DEFAULT '',
  `valor3cuota` bigint(20) DEFAULT '0',
  `fcompromisocuota3` date DEFAULT NULL,
  `3cuotapagada` tinyint(1) DEFAULT '0',
  `f3cuota` date DEFAULT NULL,
  `tpago3cuota` varchar(255) DEFAULT '',
  `bdpago3cuota` varchar(255) DEFAULT '',
  `codwebpaycuota3` varchar(30) DEFAULT '',
  `tarjpagocuota3` varchar(255) DEFAULT '',
  `valoruff` decimal(10,2) DEFAULT NULL,
  `idclientevd1` int(11) DEFAULT NULL,
  `matchclayabono` tinyint(1) DEFAULT '0',
  `matchclaycuota1` tinyint(1) DEFAULT '0',
  `matchclaycuota2` tinyint(1) DEFAULT '0',
  `matchclaycuota3` tinyint(1) DEFAULT '0',
  `idcliente` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`ventademandasid`),
  KEY `vtiger_ventademandas_relacionsiniestro_idx` (`relacionsiniestro`),
  KEY `vtiger_ventademandas_idcliente_idx` (`idcliente`),
  CONSTRAINT `fk_1_vtiger_ventademandasventademandasid` FOREIGN KEY (`ventademandasid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_currencyupdate`;
CREATE TABLE `yetiforce_currencyupdate` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `currency_id` int(10) NOT NULL,
  `fetch_date` date NOT NULL,
  `exchange_date` date NOT NULL,
  `exchange` decimal(10,4) NOT NULL,
  `bank_id` int(10) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `fetchdate_currencyid_unique` (`currency_id`,`exchange_date`,`bank_id`),
  KEY `fk_1_vtiger_osscurrencies` (`currency_id`),
  CONSTRAINT `fk_1_vtiger_osscurrencies` FOREIGN KEY (`currency_id`) REFERENCES `vtiger_currency_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_grp2grp`;
CREATE TABLE `vtiger_datashare_grp2grp` (
  `shareid` int(10) NOT NULL,
  `share_groupid` int(10) DEFAULT NULL,
  `to_groupid` int(10) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_grp2grp_share_groupid_idx` (`share_groupid`),
  KEY `datashare_grp2grp_to_groupid_idx` (`to_groupid`),
  CONSTRAINT `fk_3_vtiger_datashare_grp2grp` FOREIGN KEY (`to_groupid`) REFERENCES `vtiger_groups` (`groupid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_group2grouprel`;
CREATE TABLE `vtiger_group2grouprel` (
  `groupid` int(10) NOT NULL,
  `containsgroupid` int(10) unsigned NOT NULL,
  PRIMARY KEY (`groupid`,`containsgroupid`),
  KEY `containsgroupid` (`containsgroupid`),
  KEY `groupid` (`groupid`),
  CONSTRAINT `fk_2_vtiger_group2grouprel` FOREIGN KEY (`groupid`) REFERENCES `vtiger_groups` (`groupid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_module_dashboard_widgets`;
CREATE TABLE `vtiger_module_dashboard_widgets` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `linkid` int(10) NOT NULL,
  `userid` int(10) DEFAULT NULL,
  `templateid` int(10) NOT NULL,
  `filterid` varchar(100) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `data` text,
  `size` varchar(50) DEFAULT NULL,
  `limit` tinyint(2) DEFAULT NULL,
  `position` varchar(50) DEFAULT NULL,
  `isdefault` tinyint(1) DEFAULT '0',
  `active` tinyint(1) DEFAULT '0',
  `owners` varchar(100) DEFAULT NULL,
  `module` int(10) DEFAULT '0',
  `cache` tinyint(1) DEFAULT '0',
  `date` varchar(20) DEFAULT NULL,
  `dashboardid` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `vtiger_module_dashboard_widgets_ibfk_1` (`templateid`),
  KEY `userid` (`userid`,`active`,`module`),
  CONSTRAINT `vtiger_module_dashboard_widgets_ibfk_1` FOREIGN KEY (`templateid`) REFERENCES `vtiger_module_dashboard` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7469 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_def_org_share`;
CREATE TABLE `vtiger_def_org_share` (
  `ruleid` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) NOT NULL,
  `permission` int(10) DEFAULT NULL,
  `editstatus` int(10) DEFAULT NULL,
  PRIMARY KEY (`ruleid`),
  KEY `fk_1_vtiger_def_org_share` (`permission`),
  CONSTRAINT `fk_1_vtiger_def_org_share` FOREIGN KEY (`permission`) REFERENCES `vtiger_org_share_action_mapping` (`share_action_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=142 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_profile2field`;
CREATE TABLE `vtiger_profile2field` (
  `profileid` int(10) NOT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `fieldid` int(10) NOT NULL,
  `visible` int(10) DEFAULT NULL,
  `readonly` int(10) DEFAULT NULL,
  PRIMARY KEY (`profileid`,`fieldid`),
  KEY `profile2field_profileid_tabid_fieldname_idx` (`profileid`,`tabid`),
  KEY `profile2field_tabid_profileid_idx` (`tabid`,`profileid`),
  KEY `profile2field_visible_profileid_idx` (`visible`,`profileid`),
  CONSTRAINT `vtiger_profile2field_ibfk_1` FOREIGN KEY (`profileid`) REFERENCES `vtiger_profile` (`profileid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_profile2globalpermissions`;
CREATE TABLE `vtiger_profile2globalpermissions` (
  `profileid` int(10) NOT NULL,
  `globalactionid` int(10) NOT NULL,
  `globalactionpermission` int(10) DEFAULT NULL,
  PRIMARY KEY (`profileid`,`globalactionid`),
  KEY `idx_profile2globalpermissions` (`profileid`,`globalactionid`),
  CONSTRAINT `fk_1_vtiger_profile2globalpermissions` FOREIGN KEY (`profileid`) REFERENCES `vtiger_profile` (`profileid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_profile2tab`;
CREATE TABLE `vtiger_profile2tab` (
  `profileid` int(10) DEFAULT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `permissions` int(10) NOT NULL DEFAULT '0',
  KEY `profile2tab_profileid_tabid_idx` (`profileid`,`tabid`),
  CONSTRAINT `vtiger_profile2tab_ibfk_1` FOREIGN KEY (`profileid`) REFERENCES `vtiger_profile` (`profileid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_profile2utility`;
CREATE TABLE `vtiger_profile2utility` (
  `profileid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `activityid` int(10) NOT NULL,
  `permission` int(1) DEFAULT NULL,
  PRIMARY KEY (`profileid`,`tabid`,`activityid`),
  KEY `profile2utility_tabid_activityid_idx` (`tabid`,`activityid`),
  KEY `profile2utility_profileid` (`profileid`),
  CONSTRAINT `vtiger_profile2utility_ibfk_1` FOREIGN KEY (`profileid`) REFERENCES `vtiger_profile` (`profileid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_grp2role`;
CREATE TABLE `vtiger_datashare_grp2role` (
  `shareid` int(10) NOT NULL,
  `share_groupid` int(10) DEFAULT NULL,
  `to_roleid` varchar(255) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `idx_datashare_grp2role_share_groupid` (`share_groupid`),
  KEY `idx_datashare_grp2role_to_roleid` (`to_roleid`),
  CONSTRAINT `fk_3_vtiger_datashare_grp2role` FOREIGN KEY (`to_roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_grp2rs`;
CREATE TABLE `vtiger_datashare_grp2rs` (
  `shareid` int(10) NOT NULL,
  `share_groupid` int(10) DEFAULT NULL,
  `to_roleandsubid` varchar(255) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_grp2rs_share_groupid_idx` (`share_groupid`),
  KEY `datashare_grp2rs_to_roleandsubid_idx` (`to_roleandsubid`),
  CONSTRAINT `fk_3_vtiger_datashare_grp2rs` FOREIGN KEY (`to_roleandsubid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_role2group`;
CREATE TABLE `vtiger_datashare_role2group` (
  `shareid` int(10) NOT NULL,
  `share_roleid` varchar(255) DEFAULT NULL,
  `to_groupid` int(10) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `idx_datashare_role2group_share_roleid` (`share_roleid`),
  KEY `idx_datashare_role2group_to_groupid` (`to_groupid`),
  CONSTRAINT `fk_3_vtiger_datashare_role2group` FOREIGN KEY (`share_roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_role2role`;
CREATE TABLE `vtiger_datashare_role2role` (
  `shareid` int(10) NOT NULL,
  `share_roleid` varchar(255) DEFAULT NULL,
  `to_roleid` varchar(255) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_role2role_share_roleid_idx` (`share_roleid`),
  KEY `datashare_role2role_to_roleid_idx` (`to_roleid`),
  CONSTRAINT `fk_3_vtiger_datashare_role2role` FOREIGN KEY (`to_roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_role2rs`;
CREATE TABLE `vtiger_datashare_role2rs` (
  `shareid` int(10) NOT NULL,
  `share_roleid` varchar(255) DEFAULT NULL,
  `to_roleandsubid` varchar(255) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_role2s_share_roleid_idx` (`share_roleid`),
  KEY `datashare_role2s_to_roleandsubid_idx` (`to_roleandsubid`),
  CONSTRAINT `fk_3_vtiger_datashare_role2rs` FOREIGN KEY (`to_roleandsubid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_rs2grp`;
CREATE TABLE `vtiger_datashare_rs2grp` (
  `shareid` int(10) NOT NULL,
  `share_roleandsubid` varchar(255) DEFAULT NULL,
  `to_groupid` int(10) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_rs2grp_share_roleandsubid_idx` (`share_roleandsubid`),
  KEY `datashare_rs2grp_to_groupid_idx` (`to_groupid`),
  CONSTRAINT `fk_3_vtiger_datashare_rs2grp` FOREIGN KEY (`share_roleandsubid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_rs2role`;
CREATE TABLE `vtiger_datashare_rs2role` (
  `shareid` int(10) NOT NULL,
  `share_roleandsubid` varchar(255) DEFAULT NULL,
  `to_roleid` varchar(255) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_rs2role_share_roleandsubid_idx` (`share_roleandsubid`),
  KEY `datashare_rs2role_to_roleid_idx` (`to_roleid`),
  CONSTRAINT `fk_3_vtiger_datashare_rs2role` FOREIGN KEY (`to_roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_rs2rs`;
CREATE TABLE `vtiger_datashare_rs2rs` (
  `shareid` int(10) NOT NULL,
  `share_roleandsubid` varchar(255) DEFAULT NULL,
  `to_roleandsubid` varchar(255) DEFAULT NULL,
  `permission` int(10) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `datashare_rs2rs_share_roleandsubid_idx` (`share_roleandsubid`),
  KEY `idx_datashare_rs2rs_to_roleandsubid_idx` (`to_roleandsubid`),
  CONSTRAINT `fk_3_vtiger_datashare_rs2rs` FOREIGN KEY (`to_roleandsubid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_group2role`;
CREATE TABLE `vtiger_group2role` (
  `groupid` int(10) NOT NULL,
  `roleid` varchar(255) NOT NULL,
  PRIMARY KEY (`groupid`,`roleid`),
  KEY `fk_2_vtiger_group2role` (`roleid`),
  CONSTRAINT `fk_2_vtiger_group2role` FOREIGN KEY (`roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_group2rs`;
CREATE TABLE `vtiger_group2rs` (
  `groupid` int(10) unsigned NOT NULL,
  `roleandsubid` varchar(255) NOT NULL,
  PRIMARY KEY (`groupid`,`roleandsubid`),
  KEY `fk_2_vtiger_group2rs` (`roleandsubid`),
  CONSTRAINT `fk_2_vtiger_group2rs` FOREIGN KEY (`roleandsubid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_role2picklist`;
CREATE TABLE `vtiger_role2picklist` (
  `roleid` varchar(255) NOT NULL,
  `picklistvalueid` int(10) NOT NULL,
  `picklistid` int(10) NOT NULL,
  `sortid` int(10) DEFAULT NULL,
  PRIMARY KEY (`roleid`,`picklistvalueid`,`picklistid`),
  KEY `role2picklist_roleid_picklistid_idx` (`roleid`,`picklistid`,`picklistvalueid`),
  KEY `fk_2_vtiger_role2picklist` (`picklistid`),
  CONSTRAINT `fk_1_vtiger_role2picklist` FOREIGN KEY (`roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_vtiger_role2picklist` FOREIGN KEY (`picklistid`) REFERENCES `vtiger_picklist` (`picklistid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_role2profile`;
CREATE TABLE `vtiger_role2profile` (
  `roleid` varchar(255) NOT NULL,
  `profileid` int(10) NOT NULL,
  PRIMARY KEY (`roleid`,`profileid`),
  KEY `role2profile_roleid_profileid_idx` (`roleid`,`profileid`),
  KEY `roleid` (`roleid`),
  KEY `profileid` (`profileid`),
  CONSTRAINT `vtiger_role2profile_ibfk_1` FOREIGN KEY (`roleid`) REFERENCES `vtiger_role` (`roleid`) ON DELETE CASCADE,
  CONSTRAINT `vtiger_role2profile_ibfk_2` FOREIGN KEY (`profileid`) REFERENCES `vtiger_profile` (`profileid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_relcriteria`;
CREATE TABLE `vtiger_relcriteria` (
  `queryid` int(10) NOT NULL,
  `columnindex` int(10) NOT NULL,
  `columnname` varchar(250) DEFAULT '',
  `comparator` varchar(20) DEFAULT NULL,
  `value` varchar(512) DEFAULT NULL,
  `groupid` int(10) DEFAULT '1',
  `column_condition` varchar(256) DEFAULT 'and',
  PRIMARY KEY (`queryid`,`columnindex`),
  KEY `relcriteria_queryid_idx` (`queryid`),
  CONSTRAINT `fk_1_vtiger_relcriteria` FOREIGN KEY (`queryid`) REFERENCES `vtiger_selectquery` (`queryid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_report`;
CREATE TABLE `vtiger_report` (
  `reportid` int(10) NOT NULL,
  `folderid` int(10) NOT NULL,
  `reportname` varchar(100) DEFAULT '',
  `description` varchar(250) DEFAULT '',
  `reporttype` varchar(50) DEFAULT '',
  `queryid` int(10) NOT NULL DEFAULT '0',
  `state` varchar(50) DEFAULT 'SAVED',
  `customizable` int(1) DEFAULT '1',
  `category` int(10) DEFAULT '1',
  `owner` int(10) DEFAULT '1',
  `sharingtype` varchar(200) DEFAULT 'Private',
  PRIMARY KEY (`reportid`),
  KEY `report_queryid_idx` (`queryid`),
  KEY `report_folderid_idx` (`folderid`),
  CONSTRAINT `fk_2_vtiger_report` FOREIGN KEY (`queryid`) REFERENCES `vtiger_selectquery` (`queryid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_selectcolumn`;
CREATE TABLE `vtiger_selectcolumn` (
  `queryid` int(10) NOT NULL,
  `columnindex` int(10) NOT NULL DEFAULT '0',
  `columnname` varchar(250) DEFAULT '',
  PRIMARY KEY (`queryid`,`columnindex`),
  KEY `selectcolumn_queryid_idx` (`queryid`),
  CONSTRAINT `fk_1_vtiger_selectcolumn` FOREIGN KEY (`queryid`) REFERENCES `vtiger_selectquery` (`queryid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_settings_field`;
CREATE TABLE `vtiger_settings_field` (
  `fieldid` int(10) NOT NULL AUTO_INCREMENT,
  `blockid` int(10) DEFAULT NULL,
  `name` varchar(250) DEFAULT NULL,
  `iconpath` varchar(300) DEFAULT NULL,
  `description` varchar(250) DEFAULT NULL,
  `linkto` text,
  `sequence` int(10) DEFAULT NULL,
  `active` int(10) DEFAULT '0',
  `pinned` int(1) DEFAULT '0',
  `admin_access` text,
  PRIMARY KEY (`fieldid`),
  KEY `fk_1_vtiger_settings_field` (`blockid`),
  CONSTRAINT `fk_1_vtiger_settings_field` FOREIGN KEY (`blockid`) REFERENCES `vtiger_settings_blocks` (`blockid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_blocks`;
CREATE TABLE `vtiger_blocks` (
  `blockid` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) NOT NULL,
  `blocklabel` varchar(100) NOT NULL,
  `sequence` int(10) DEFAULT NULL,
  `show_title` int(2) DEFAULT NULL,
  `visible` int(2) NOT NULL DEFAULT '0',
  `create_view` int(2) NOT NULL DEFAULT '0',
  `edit_view` int(2) NOT NULL DEFAULT '0',
  `detail_view` int(2) NOT NULL DEFAULT '0',
  `display_status` int(1) NOT NULL DEFAULT '1',
  `iscustom` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`blockid`),
  KEY `block_tabid_idx` (`tabid`),
  CONSTRAINT `fk_1_vtiger_blocks` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=792 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_customview`;
CREATE TABLE `vtiger_customview` (
  `cvid` int(10) NOT NULL AUTO_INCREMENT,
  `viewname` varchar(100) NOT NULL,
  `setdefault` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `setmetrics` tinyint(1) NOT NULL DEFAULT '0',
  `entitytype` varchar(25) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `userid` int(10) DEFAULT '1',
  `privileges` tinyint(2) DEFAULT '1',
  `featured` tinyint(1) DEFAULT '0',
  `sequence` int(10) DEFAULT NULL,
  `presence` tinyint(1) DEFAULT '1',
  `description` text,
  `sort` varchar(30) DEFAULT '',
  `color` varchar(10) DEFAULT '',
  PRIMARY KEY (`cvid`),
  KEY `customview_entitytype_idx` (`entitytype`),
  KEY `setdefault` (`setdefault`,`entitytype`),
  CONSTRAINT `fk_1_vtiger_customview` FOREIGN KEY (`entitytype`) REFERENCES `vtiger_tab` (`name`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1465 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_module_rel`;
CREATE TABLE `vtiger_datashare_module_rel` (
  `shareid` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) NOT NULL,
  `relationtype` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`shareid`),
  KEY `idx_datashare_module_rel_tabid` (`tabid`),
  CONSTRAINT `fk_1_vtiger_datashare_module_rel` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_datashare_relatedmodules`;
CREATE TABLE `vtiger_datashare_relatedmodules` (
  `datashare_relatedmodule_id` int(10) NOT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `relatedto_tabid` int(10) DEFAULT NULL,
  PRIMARY KEY (`datashare_relatedmodule_id`),
  KEY `datashare_relatedmodules_tabid_idx` (`tabid`),
  KEY `datashare_relatedmodules_relatedto_tabid_idx` (`relatedto_tabid`),
  CONSTRAINT `fk_2_vtiger_datashare_relatedmodules` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_defaultcv`;
CREATE TABLE `vtiger_defaultcv` (
  `tabid` smallint(5) NOT NULL,
  `defaultviewname` varchar(50) NOT NULL,
  `query` text,
  PRIMARY KEY (`tabid`),
  CONSTRAINT `fk_1_vtiger_defaultcv` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_entityname`;
CREATE TABLE `vtiger_entityname` (
  `tabid` smallint(5) NOT NULL DEFAULT '0',
  `modulename` varchar(25) NOT NULL,
  `tablename` varchar(50) NOT NULL,
  `fieldname` varchar(100) NOT NULL,
  `entityidfield` varchar(30) NOT NULL,
  `entityidcolumn` varchar(30) NOT NULL,
  `searchcolumn` varchar(150) NOT NULL,
  `turn_off` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `sequence` smallint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`tabid`),
  KEY `turn_off` (`turn_off`),
  CONSTRAINT `fk_1_vtiger_entityname` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_field`;
CREATE TABLE `vtiger_field` (
  `tabid` smallint(5) NOT NULL,
  `fieldid` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `tablename` varchar(50) NOT NULL,
  `generatedtype` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `uitype` smallint(5) unsigned NOT NULL,
  `fieldname` varchar(50) NOT NULL,
  `fieldlabel` varchar(50) NOT NULL,
  `readonly` tinyint(1) unsigned NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `defaultvalue` text,
  `maximumlength` smallint(5) unsigned NOT NULL,
  `sequence` smallint(5) unsigned NOT NULL,
  `block` int(10) DEFAULT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL,
  `typeofdata` varchar(100) DEFAULT NULL,
  `quickcreate` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `quickcreatesequence` int(10) DEFAULT NULL,
  `info_type` varchar(20) DEFAULT NULL,
  `masseditable` int(10) NOT NULL DEFAULT '1',
  `helpinfo` varchar(30) DEFAULT '',
  `summaryfield` int(10) NOT NULL DEFAULT '0',
  `fieldparams` varchar(255) DEFAULT '',
  `header_field` varchar(15) DEFAULT NULL,
  `maxlengthtext` smallint(3) unsigned DEFAULT '0',
  `maxwidthcolumn` smallint(3) unsigned DEFAULT '0',
  PRIMARY KEY (`fieldid`),
  KEY `field_tabid_idx` (`tabid`),
  KEY `field_fieldname_idx` (`fieldname`),
  KEY `field_block_idx` (`block`),
  KEY `field_displaytype_idx` (`displaytype`),
  KEY `tabid` (`tabid`,`tablename`),
  KEY `quickcreate` (`quickcreate`),
  KEY `presence` (`presence`),
  KEY `tabid_2` (`tabid`,`fieldname`),
  KEY `tabid_3` (`tabid`,`block`),
  CONSTRAINT `fk_1_vtiger_field` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5810 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_group2modules`;
CREATE TABLE `vtiger_group2modules` (
  `groupid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  KEY `groupid` (`groupid`),
  KEY `tabid` (`tabid`),
  CONSTRAINT `vtiger_group2modules_ibfk_1` FOREIGN KEY (`groupid`) REFERENCES `vtiger_groups` (`groupid`) ON DELETE CASCADE,
  CONSTRAINT `vtiger_group2modules_ibfk_2` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_org_share_action2tab`;
CREATE TABLE `vtiger_org_share_action2tab` (
  `share_action_id` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  PRIMARY KEY (`share_action_id`,`tabid`),
  KEY `fk_2_vtiger_org_share_action2tab` (`tabid`),
  CONSTRAINT `fk_2_vtiger_org_share_action2tab` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tab_info`;
CREATE TABLE `vtiger_tab_info` (
  `tabid` smallint(5) DEFAULT NULL,
  `prefname` varchar(256) DEFAULT NULL,
  `prefvalue` varchar(256) DEFAULT NULL,
  KEY `fk_1_vtiger_tab_info` (`tabid`),
  CONSTRAINT `fk_1_vtiger_tab_info` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_user_module_preferences`;
CREATE TABLE `vtiger_user_module_preferences` (
  `userid` varchar(30) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `default_cvid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`),
  KEY `fk_2_vtiger_user_module_preferences` (`tabid`),
  CONSTRAINT `fk_2_vtiger_user_module_preferences` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_widgets`;
CREATE TABLE `vtiger_widgets` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) DEFAULT NULL,
  `type` varchar(30) DEFAULT NULL,
  `label` varchar(100) DEFAULT NULL,
  `wcol` tinyint(1) DEFAULT '1',
  `sequence` tinyint(2) DEFAULT NULL,
  `nomargin` tinyint(1) DEFAULT '0',
  `data` text,
  PRIMARY KEY (`id`),
  KEY `tabid` (`tabid`),
  CONSTRAINT `vtiger_widgets_ibfk_1` FOREIGN KEY (`tabid`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=227 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `yetiforce_menu`;
CREATE TABLE `yetiforce_menu` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `role` int(10) DEFAULT NULL,
  `parentid` int(10) DEFAULT '0',
  `type` tinyint(1) DEFAULT NULL,
  `sequence` int(3) DEFAULT NULL,
  `module` smallint(5) DEFAULT NULL,
  `label` varchar(100) DEFAULT NULL,
  `newwindow` tinyint(1) DEFAULT '0',
  `dataurl` text,
  `showicon` tinyint(1) DEFAULT '0',
  `icon` varchar(255) DEFAULT NULL,
  `sizeicon` varchar(255) DEFAULT NULL,
  `hotkey` varchar(30) DEFAULT NULL,
  `filters` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `parent_id` (`parentid`),
  KEY `role` (`role`),
  KEY `module` (`module`),
  CONSTRAINT `yetiforce_menu_ibfk_1` FOREIGN KEY (`module`) REFERENCES `vtiger_tab` (`tabid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1653 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `a_yf_bruteforce_users`;
CREATE TABLE `a_yf_bruteforce_users` (
  `id` int(10) NOT NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT `fk_1_vtiger_bruteforce_users` FOREIGN KEY (`id`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_reviewed_queue`;
CREATE TABLE `u_yf_reviewed_queue` (
  `id` int(10) NOT NULL,
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `data` text,
  `time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `userid` (`userid`),
  CONSTRAINT `fk_1_u_yf_reviewed_queue` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_watchdog_schedule`;
CREATE TABLE `u_yf_watchdog_schedule` (
  `userid` int(10) NOT NULL,
  `frequency` smallint(5) NOT NULL,
  `last_execution` datetime DEFAULT NULL,
  `modules` text,
  PRIMARY KEY (`userid`),
  CONSTRAINT `u_yf_watchdog_schedule_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_salesmanticketrel`;
CREATE TABLE `vtiger_salesmanticketrel` (
  `smid` int(10) NOT NULL DEFAULT '0',
  `id` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`smid`,`id`),
  KEY `salesmanticketrel_smid_idx` (`smid`),
  KEY `salesmanticketrel_id_idx` (`id`),
  CONSTRAINT `fk_2_vtiger_salesmanticketrel` FOREIGN KEY (`smid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_read_group_rel_sharing_per`;
CREATE TABLE `vtiger_tmp_read_group_rel_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `relatedtabid` int(10) NOT NULL,
  `sharedgroupid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`relatedtabid`,`sharedgroupid`),
  KEY `tmp_read_group_rel_sharing_per_userid_sharedgroupid_tabid` (`userid`,`sharedgroupid`,`tabid`),
  CONSTRAINT `fk_4_vtiger_tmp_read_group_rel_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_read_group_sharing_per`;
CREATE TABLE `vtiger_tmp_read_group_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `sharedgroupid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`sharedgroupid`),
  KEY `tmp_read_group_sharing_per_userid_sharedgroupid_idx` (`userid`,`sharedgroupid`),
  CONSTRAINT `fk_3_vtiger_tmp_read_group_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_read_user_rel_sharing_per`;
CREATE TABLE `vtiger_tmp_read_user_rel_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `relatedtabid` int(10) NOT NULL,
  `shareduserid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`relatedtabid`,`shareduserid`),
  KEY `tmp_read_user_rel_sharing_per_userid_shared_reltabid_idx` (`userid`,`shareduserid`,`relatedtabid`),
  CONSTRAINT `fk_4_vtiger_tmp_read_user_rel_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_read_user_sharing_per`;
CREATE TABLE `vtiger_tmp_read_user_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `shareduserid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`shareduserid`),
  KEY `tmp_read_user_sharing_per_userid_shareduserid_idx` (`userid`,`shareduserid`),
  CONSTRAINT `fk_3_vtiger_tmp_read_user_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_write_group_rel_sharing_per`;
CREATE TABLE `vtiger_tmp_write_group_rel_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `relatedtabid` int(10) NOT NULL,
  `sharedgroupid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`relatedtabid`,`sharedgroupid`),
  KEY `tmp_write_group_rel_sharing_per_userid_sharedgroupid_tabid_idx` (`userid`,`sharedgroupid`,`tabid`),
  CONSTRAINT `fk_4_vtiger_tmp_write_group_rel_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_write_group_sharing_per`;
CREATE TABLE `vtiger_tmp_write_group_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `sharedgroupid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`sharedgroupid`),
  KEY `tmp_write_group_sharing_per_UK1` (`userid`,`sharedgroupid`),
  CONSTRAINT `fk_3_vtiger_tmp_write_group_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_write_user_rel_sharing_per`;
CREATE TABLE `vtiger_tmp_write_user_rel_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `relatedtabid` int(10) NOT NULL,
  `shareduserid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`relatedtabid`,`shareduserid`),
  KEY `tmp_write_user_rel_sharing_per_userid_sharduserid_tabid_idx` (`userid`,`shareduserid`,`tabid`),
  CONSTRAINT `fk_4_vtiger_tmp_write_user_rel_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_tmp_write_user_sharing_per`;
CREATE TABLE `vtiger_tmp_write_user_sharing_per` (
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) NOT NULL,
  `shareduserid` int(10) NOT NULL,
  PRIMARY KEY (`userid`,`tabid`,`shareduserid`),
  KEY `tmp_write_user_sharing_per_userid_shareduserid_idx` (`userid`,`shareduserid`),
  CONSTRAINT `fk_3_vtiger_tmp_write_user_sharing_per` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_user2role`;
CREATE TABLE `vtiger_user2role` (
  `userid` int(10) NOT NULL,
  `roleid` varchar(255) NOT NULL,
  PRIMARY KEY (`userid`),
  KEY `user2role_roleid_idx` (`roleid`),
  CONSTRAINT `fk_2_vtiger_user2role` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_users2group`;
CREATE TABLE `vtiger_users2group` (
  `groupid` int(10) NOT NULL,
  `userid` int(10) NOT NULL,
  PRIMARY KEY (`groupid`,`userid`),
  KEY `users2group_groupname_uerid_idx` (`groupid`,`userid`),
  KEY `fk_2_vtiger_users2group` (`userid`),
  CONSTRAINT `fk_2_vtiger_users2group` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_userscf`;
CREATE TABLE `vtiger_userscf` (
  `usersid` int(10) NOT NULL,
  PRIMARY KEY (`usersid`),
  CONSTRAINT `vtiger_userscf_ibfk_1` FOREIGN KEY (`usersid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ws_referencetype`;
CREATE TABLE `vtiger_ws_referencetype` (
  `fieldtypeid` int(10) NOT NULL,
  `type` varchar(25) NOT NULL,
  PRIMARY KEY (`fieldtypeid`,`type`),
  KEY `fieldtypeid` (`fieldtypeid`),
  CONSTRAINT `fk_1_vtiger_referencetype` FOREIGN KEY (`fieldtypeid`) REFERENCES `vtiger_ws_fieldtype` (`fieldtypeid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `dav_cards`;
CREATE TABLE `dav_cards` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `addressbookid` int(10) unsigned NOT NULL,
  `carddata` mediumblob,
  `uri` varbinary(200) DEFAULT NULL,
  `lastmodified` int(10) unsigned DEFAULT NULL,
  `etag` varbinary(32) DEFAULT NULL,
  `size` int(10) unsigned NOT NULL,
  `crmid` int(10) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `addressbookid` (`addressbookid`,`crmid`),
  CONSTRAINT `dav_cards_ibfk_1` FOREIGN KEY (`addressbookid`) REFERENCES `dav_addressbooks` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;;

DROP TABLE IF EXISTS `roundcube_contactgroupmembers`;
CREATE TABLE `roundcube_contactgroupmembers` (
  `contactgroup_id` int(10) unsigned NOT NULL,
  `contact_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  PRIMARY KEY (`contactgroup_id`,`contact_id`),
  KEY `roundcube_contactgroupmembers_contact_index` (`contact_id`),
  CONSTRAINT `roundcube_contact_id_fk_contacts` FOREIGN KEY (`contact_id`) REFERENCES `roundcube_contacts` (`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `roundcube_contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`) REFERENCES `roundcube_contactgroups` (`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_announcement_mark`;
CREATE TABLE `u_yf_announcement_mark` (
  `announcementid` int(10) NOT NULL,
  `userid` int(10) NOT NULL,
  `date` datetime NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`announcementid`,`userid`),
  KEY `userid` (`userid`,`status`),
  KEY `announcementid` (`announcementid`,`userid`,`date`,`status`),
  CONSTRAINT `u_yf_announcement_mark_ibfk_1` FOREIGN KEY (`announcementid`) REFERENCES `u_yf_announcement` (`announcementid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_announcementcf`;
CREATE TABLE `u_yf_announcementcf` (
  `announcementid` int(10) NOT NULL,
  PRIMARY KEY (`announcementid`),
  CONSTRAINT `fk_1_u_yf_announcementcf` FOREIGN KEY (`announcementid`) REFERENCES `u_yf_announcement` (`announcementid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cfixedassetscf`;
CREATE TABLE `u_yf_cfixedassetscf` (
  `cfixedassetsid` int(10) NOT NULL,
  PRIMARY KEY (`cfixedassetsid`),
  CONSTRAINT `fk_1_vtiger_cfixedassetscfcfixedassetsid` FOREIGN KEY (`cfixedassetsid`) REFERENCES `u_yf_cfixedassets` (`cfixedassetsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cinternalticketscf`;
CREATE TABLE `u_yf_cinternalticketscf` (
  `cinternalticketsid` int(10) NOT NULL,
  PRIMARY KEY (`cinternalticketsid`),
  CONSTRAINT `fk_1_vtiger_cinternalticketscfcinternalticketsid` FOREIGN KEY (`cinternalticketsid`) REFERENCES `u_yf_cinternaltickets` (`cinternalticketsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_cmileagelogbookcf`;
CREATE TABLE `u_yf_cmileagelogbookcf` (
  `cmileagelogbookid` int(10) NOT NULL,
  PRIMARY KEY (`cmileagelogbookid`),
  CONSTRAINT `fk_1_vtiger_cmileagelogbookcfcmileagelogbookid` FOREIGN KEY (`cmileagelogbookid`) REFERENCES `u_yf_cmileagelogbook` (`cmileagelogbookid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_competition_address`;
CREATE TABLE `u_yf_competition_address` (
  `competitionaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`competitionaddressid`),
  CONSTRAINT `u_yf_competition_address_ibfk_1` FOREIGN KEY (`competitionaddressid`) REFERENCES `u_yf_competition` (`competitionid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_competitioncf`;
CREATE TABLE `u_yf_competitioncf` (
  `competitionid` int(10) NOT NULL,
  PRIMARY KEY (`competitionid`),
  CONSTRAINT `fk_1_u_yf_competitioncf` FOREIGN KEY (`competitionid`) REFERENCES `u_yf_competition` (`competitionid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_fbookkeepingcf`;
CREATE TABLE `u_yf_fbookkeepingcf` (
  `fbookkeepingid` int(10) NOT NULL,
  PRIMARY KEY (`fbookkeepingid`),
  CONSTRAINT `u_yf_fbookkeepingcf_ibfk_1` FOREIGN KEY (`fbookkeepingid`) REFERENCES `u_yf_fbookkeeping` (`fbookkeepingid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_fcorectinginvoice_address`;
CREATE TABLE `u_yf_fcorectinginvoice_address` (
  `fcorectinginvoiceaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`fcorectinginvoiceaddressid`),
  CONSTRAINT `u_yf_fcorectinginvoice_address_ibfk_1` FOREIGN KEY (`fcorectinginvoiceaddressid`) REFERENCES `u_yf_fcorectinginvoice` (`fcorectinginvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_fcorectinginvoice_inventory`;
CREATE TABLE `u_yf_fcorectinginvoice_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `comment1` text,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_fcorectinginvoice_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_fcorectinginvoice` (`fcorectinginvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_fcorectinginvoicecf`;
CREATE TABLE `u_yf_fcorectinginvoicecf` (
  `fcorectinginvoiceid` int(10) NOT NULL,
  PRIMARY KEY (`fcorectinginvoiceid`),
  CONSTRAINT `fk_1_u_yf_fcorectinginvoicecf` FOREIGN KEY (`fcorectinginvoiceid`) REFERENCES `u_yf_fcorectinginvoice` (`fcorectinginvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoice_address`;
CREATE TABLE `u_yf_finvoice_address` (
  `finvoiceaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`finvoiceaddressid`),
  CONSTRAINT `u_yf_finvoice_address_ibfk_1` FOREIGN KEY (`finvoiceaddressid`) REFERENCES `u_yf_finvoice` (`finvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoice_inventory`;
CREATE TABLE `u_yf_finvoice_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `discountparam` varchar(255) DEFAULT NULL,
  `comment1` text,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_finvoice_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_finvoice` (`finvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoicecf`;
CREATE TABLE `u_yf_finvoicecf` (
  `finvoiceid` int(10) NOT NULL,
  PRIMARY KEY (`finvoiceid`),
  CONSTRAINT `fk_1_u_yf_finvoicecf` FOREIGN KEY (`finvoiceid`) REFERENCES `u_yf_finvoice` (`finvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoicecost_address`;
CREATE TABLE `u_yf_finvoicecost_address` (
  `finvoicecostaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`finvoicecostaddressid`),
  CONSTRAINT `u_yf_finvoicecost_address_ibfk_1` FOREIGN KEY (`finvoicecostaddressid`) REFERENCES `u_yf_finvoicecost` (`finvoicecostid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoicecostcf`;
CREATE TABLE `u_yf_finvoicecostcf` (
  `finvoicecostid` int(10) NOT NULL,
  PRIMARY KEY (`finvoicecostid`),
  CONSTRAINT `fk_1_u_yf_finvoicecostcf` FOREIGN KEY (`finvoicecostid`) REFERENCES `u_yf_finvoicecost` (`finvoicecostid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoiceproforma_inventory`;
CREATE TABLE `u_yf_finvoiceproforma_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_finvoiceproforma_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_finvoiceproforma` (`finvoiceproformaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_finvoiceproformacf`;
CREATE TABLE `u_yf_finvoiceproformacf` (
  `finvoiceproformaid` int(10) NOT NULL,
  PRIMARY KEY (`finvoiceproformaid`),
  CONSTRAINT `fk_1_vtiger_finvoiceproformacf` FOREIGN KEY (`finvoiceproformaid`) REFERENCES `u_yf_finvoiceproforma` (`finvoiceproformaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igdn_inventory`;
CREATE TABLE `u_yf_igdn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igdn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igdn` (`igdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igdncf`;
CREATE TABLE `u_yf_igdncf` (
  `igdnid` int(10) NOT NULL,
  PRIMARY KEY (`igdnid`),
  CONSTRAINT `u_yf_igdncf_ibfk_1` FOREIGN KEY (`igdnid`) REFERENCES `u_yf_igdn` (`igdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igdnc_inventory`;
CREATE TABLE `u_yf_igdnc_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igdnc_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igdnc` (`igdncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igdnccf`;
CREATE TABLE `u_yf_igdnccf` (
  `igdncid` int(10) NOT NULL,
  PRIMARY KEY (`igdncid`),
  CONSTRAINT `u_yf_igdnccf_ibfk_1` FOREIGN KEY (`igdncid`) REFERENCES `u_yf_igdnc` (`igdncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igin_inventory`;
CREATE TABLE `u_yf_igin_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igin_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igin` (`iginid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igincf`;
CREATE TABLE `u_yf_igincf` (
  `iginid` int(10) NOT NULL,
  PRIMARY KEY (`iginid`),
  CONSTRAINT `u_yf_igincf_ibfk_1` FOREIGN KEY (`iginid`) REFERENCES `u_yf_igin` (`iginid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igrn_inventory`;
CREATE TABLE `u_yf_igrn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igrn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igrn` (`igrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igrncf`;
CREATE TABLE `u_yf_igrncf` (
  `igrnid` int(10) NOT NULL,
  PRIMARY KEY (`igrnid`),
  CONSTRAINT `u_yf_igrncf_ibfk_1` FOREIGN KEY (`igrnid`) REFERENCES `u_yf_igrn` (`igrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igrnc_inventory`;
CREATE TABLE `u_yf_igrnc_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igrnc_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igrnc` (`igrncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_igrnccf`;
CREATE TABLE `u_yf_igrnccf` (
  `igrncid` int(10) NOT NULL,
  PRIMARY KEY (`igrncid`),
  CONSTRAINT `u_yf_igrnccf_ibfk_1` FOREIGN KEY (`igrncid`) REFERENCES `u_yf_igrnc` (`igrncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_iidn_inventory`;
CREATE TABLE `u_yf_iidn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_iidn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_iidn` (`iidnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_iidncf`;
CREATE TABLE `u_yf_iidncf` (
  `iidnid` int(10) NOT NULL,
  PRIMARY KEY (`iidnid`),
  CONSTRAINT `u_yf_iidncf_ibfk_1` FOREIGN KEY (`iidnid`) REFERENCES `u_yf_iidn` (`iidnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ipreorder_inventory`;
CREATE TABLE `u_yf_ipreorder_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_ipreorder_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_ipreorder` (`ipreorderid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ipreordercf`;
CREATE TABLE `u_yf_ipreordercf` (
  `ipreorderid` int(10) NOT NULL,
  PRIMARY KEY (`ipreorderid`),
  CONSTRAINT `u_yf_ipreordercf_ibfk_1` FOREIGN KEY (`ipreorderid`) REFERENCES `u_yf_ipreorder` (`ipreorderid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istdn_inventory`;
CREATE TABLE `u_yf_istdn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_istdn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_istdn` (`istdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istdncf`;
CREATE TABLE `u_yf_istdncf` (
  `istdnid` int(10) NOT NULL,
  PRIMARY KEY (`istdnid`),
  CONSTRAINT `u_yf_istdncf_ibfk_1` FOREIGN KEY (`istdnid`) REFERENCES `u_yf_istdn` (`istdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istncf`;
CREATE TABLE `u_yf_istncf` (
  `istnid` int(10) NOT NULL,
  PRIMARY KEY (`istnid`),
  CONSTRAINT `u_yf_istncf_ibfk_1` FOREIGN KEY (`istnid`) REFERENCES `u_yf_istn` (`istnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istorages_address`;
CREATE TABLE `u_yf_istorages_address` (
  `istorageaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`istorageaddressid`),
  CONSTRAINT `u_yf_istorages_address_ibfk_1` FOREIGN KEY (`istorageaddressid`) REFERENCES `u_yf_istorages` (`istorageid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istoragescf`;
CREATE TABLE `u_yf_istoragescf` (
  `istorageid` int(10) NOT NULL,
  PRIMARY KEY (`istorageid`),
  CONSTRAINT `u_yf_istoragescf_ibfk_1` FOREIGN KEY (`istorageid`) REFERENCES `u_yf_istorages` (`istorageid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istrn_inventory`;
CREATE TABLE `u_yf_istrn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_istrn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_istrn` (`istrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_istrncf`;
CREATE TABLE `u_yf_istrncf` (
  `istrnid` int(10) NOT NULL,
  PRIMARY KEY (`istrnid`),
  CONSTRAINT `u_yf_istrncf_ibfk_1` FOREIGN KEY (`istrnid`) REFERENCES `u_yf_istrn` (`istrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_knowledgebasecf`;
CREATE TABLE `u_yf_knowledgebasecf` (
  `knowledgebaseid` int(10) NOT NULL,
  PRIMARY KEY (`knowledgebaseid`),
  CONSTRAINT `fk_1_vtiger_knowledgebasecf` FOREIGN KEY (`knowledgebaseid`) REFERENCES `u_yf_knowledgebase` (`knowledgebaseid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_multicompanycf`;
CREATE TABLE `u_yf_multicompanycf` (
  `multicompanyid` int(11) NOT NULL,
  `public_notes` text,
  `internal_notes` text,
  PRIMARY KEY (`multicompanyid`),
  CONSTRAINT `fk_1_u_yf_multicompanycfmulticompanyid` FOREIGN KEY (`multicompanyid`) REFERENCES `u_yf_multicompany` (`multicompanyid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_partners_address`;
CREATE TABLE `u_yf_partners_address` (
  `partneraddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`partneraddressid`),
  CONSTRAINT `u_yf_partners_address_ibfk_1` FOREIGN KEY (`partneraddressid`) REFERENCES `u_yf_partners` (`partnersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_partnerscf`;
CREATE TABLE `u_yf_partnerscf` (
  `partnersid` int(10) NOT NULL,
  PRIMARY KEY (`partnersid`),
  CONSTRAINT `fk_1_u_yf_partnerscf` FOREIGN KEY (`partnersid`) REFERENCES `u_yf_partners` (`partnersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_scalculations_inventory`;
CREATE TABLE `u_yf_scalculations_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `purchase` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `marginp` decimal(28,8) DEFAULT '0.00000000',
  `margin` decimal(28,8) DEFAULT '0.00000000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_scalculations_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_scalculations` (`scalculationsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_scalculationscf`;
CREATE TABLE `u_yf_scalculationscf` (
  `scalculationsid` int(10) NOT NULL,
  PRIMARY KEY (`scalculationsid`),
  CONSTRAINT `fk_1_u_yf_scalculationscf` FOREIGN KEY (`scalculationsid`) REFERENCES `u_yf_scalculations` (`scalculationsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squoteenquiries_inventory`;
CREATE TABLE `u_yf_squoteenquiries_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_squoteenquiries_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_squoteenquiries` (`squoteenquiriesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squoteenquiriescf`;
CREATE TABLE `u_yf_squoteenquiriescf` (
  `squoteenquiriesid` int(10) NOT NULL,
  PRIMARY KEY (`squoteenquiriesid`),
  CONSTRAINT `fk_1_u_yf_squoteenquiriescf` FOREIGN KEY (`squoteenquiriesid`) REFERENCES `u_yf_squoteenquiries` (`squoteenquiriesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squotes_address`;
CREATE TABLE `u_yf_squotes_address` (
  `squotesaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`squotesaddressid`),
  CONSTRAINT `u_yf_squotes_address_ibfk_1` FOREIGN KEY (`squotesaddressid`) REFERENCES `u_yf_squotes` (`squotesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squotes_inventory`;
CREATE TABLE `u_yf_squotes_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `marginp` decimal(28,8) DEFAULT '0.00000000',
  `margin` decimal(28,8) DEFAULT '0.00000000',
  `comment1` text,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `purchase` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_squotes_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_squotes` (`squotesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_squotescf`;
CREATE TABLE `u_yf_squotescf` (
  `squotesid` int(10) NOT NULL,
  PRIMARY KEY (`squotesid`),
  CONSTRAINT `fk_1_u_yf_squotescf` FOREIGN KEY (`squotesid`) REFERENCES `u_yf_squotes` (`squotesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srecurringorders_address`;
CREATE TABLE `u_yf_srecurringorders_address` (
  `srecurringordersaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`srecurringordersaddressid`),
  CONSTRAINT `u_yf_srecurringorders_address_ibfk_1` FOREIGN KEY (`srecurringordersaddressid`) REFERENCES `u_yf_srecurringorders` (`srecurringordersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srecurringorders_inventory`;
CREATE TABLE `u_yf_srecurringorders_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `marginp` decimal(28,8) DEFAULT '0.00000000',
  `margin` decimal(28,8) DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `comment1` text,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_srecurringorders_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_srecurringorders` (`srecurringordersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srecurringorderscf`;
CREATE TABLE `u_yf_srecurringorderscf` (
  `srecurringordersid` int(10) NOT NULL,
  PRIMARY KEY (`srecurringordersid`),
  CONSTRAINT `fk_1_u_yf_srecurringorderscf` FOREIGN KEY (`srecurringordersid`) REFERENCES `u_yf_srecurringorders` (`srecurringordersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srequirementscards_inventory`;
CREATE TABLE `u_yf_srequirementscards_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_srequirementscards_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_srequirementscards` (`srequirementscardsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_srequirementscardscf`;
CREATE TABLE `u_yf_srequirementscardscf` (
  `srequirementscardsid` int(10) NOT NULL,
  PRIMARY KEY (`srequirementscardsid`),
  CONSTRAINT `fk_1_u_yf_srequirementscardscf` FOREIGN KEY (`srequirementscardsid`) REFERENCES `u_yf_srequirementscards` (`srequirementscardsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ssalesprocessescf`;
CREATE TABLE `u_yf_ssalesprocessescf` (
  `ssalesprocessesid` int(10) NOT NULL,
  PRIMARY KEY (`ssalesprocessesid`),
  CONSTRAINT `fk_1_u_yf_ssalesprocessescf` FOREIGN KEY (`ssalesprocessesid`) REFERENCES `u_yf_ssalesprocesses` (`ssalesprocessesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ssingleorders_address`;
CREATE TABLE `u_yf_ssingleorders_address` (
  `ssingleordersaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`ssingleordersaddressid`),
  CONSTRAINT `u_yf_ssingleorders_address_ibfk_1` FOREIGN KEY (`ssingleordersaddressid`) REFERENCES `u_yf_ssingleorders` (`ssingleordersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ssingleorders_inventory`;
CREATE TABLE `u_yf_ssingleorders_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `marginp` decimal(28,8) DEFAULT '0.00000000',
  `margin` decimal(28,8) DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `comment1` text,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `purchase` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_ssingleorders_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_ssingleorders` (`ssingleordersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_ssingleorderscf`;
CREATE TABLE `u_yf_ssingleorderscf` (
  `ssingleordersid` int(10) NOT NULL,
  PRIMARY KEY (`ssingleordersid`),
  CONSTRAINT `fk_1_u_yf_ssingleorderscf` FOREIGN KEY (`ssingleordersid`) REFERENCES `u_yf_ssingleorders` (`ssingleordersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_svendorenquiriescf`;
CREATE TABLE `u_yf_svendorenquiriescf` (
  `svendorenquiriesid` int(10) NOT NULL,
  PRIMARY KEY (`svendorenquiriesid`),
  CONSTRAINT `fk_1_u_yf_svendorenquiriescf` FOREIGN KEY (`svendorenquiriesid`) REFERENCES `u_yf_svendorenquiries` (`svendorenquiriesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_DemandaPagoRetenidocf`;
CREATE TABLE `vtiger_DemandaPagoRetenidocf` (
  `DemandaPagoRetenidoid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`DemandaPagoRetenidoid`),
  CONSTRAINT `fk_1_vtiger_DemandaPagoRetenidocfDemandaPagoRetenidoid` FOREIGN KEY (`DemandaPagoRetenidoid`) REFERENCES `vtiger_DemandaPagoRetenido` (`DemandaPagoRetenidoid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_accountaddress`;
CREATE TABLE `vtiger_accountaddress` (
  `accountaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel1b` varchar(255) DEFAULT NULL,
  `addresslevel1c` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel2b` varchar(255) DEFAULT NULL,
  `addresslevel2c` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel3b` varchar(255) DEFAULT NULL,
  `addresslevel3c` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel4b` varchar(255) DEFAULT NULL,
  `addresslevel4c` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel5b` varchar(255) DEFAULT NULL,
  `addresslevel5c` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel6b` varchar(255) DEFAULT NULL,
  `addresslevel6c` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel7b` varchar(255) DEFAULT NULL,
  `addresslevel7c` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `addresslevel8b` varchar(255) DEFAULT NULL,
  `addresslevel8c` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `buildingnumberb` varchar(100) DEFAULT NULL,
  `localnumberb` varchar(100) DEFAULT NULL,
  `buildingnumberc` varchar(100) DEFAULT NULL,
  `localnumberc` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  `poboxb` varchar(50) DEFAULT NULL,
  `poboxc` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`accountaddressid`),
  CONSTRAINT `vtiger_accountaddress_ibfk_1` FOREIGN KEY (`accountaddressid`) REFERENCES `vtiger_account` (`accountid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_accountscf`;
CREATE TABLE `vtiger_accountscf` (
  `accountid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`accountid`),
  CONSTRAINT `fk_1_vtiger_accountscf` FOREIGN KEY (`accountid`) REFERENCES `vtiger_account` (`accountid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_activity_invitation`;
CREATE TABLE `u_yf_activity_invitation` (
  `inviteesid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `activityid` int(10) NOT NULL,
  `crmid` int(10) NOT NULL DEFAULT '0',
  `email` varchar(100) NOT NULL DEFAULT '',
  `status` tinyint(1) DEFAULT '0',
  `time` datetime DEFAULT NULL,
  PRIMARY KEY (`inviteesid`),
  KEY `activityid` (`activityid`),
  CONSTRAINT `u_yf_activity_invitation_ibfk_1` FOREIGN KEY (`activityid`) REFERENCES `vtiger_activity` (`activityid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_activity_reminder`;
CREATE TABLE `vtiger_activity_reminder` (
  `activity_id` int(10) NOT NULL,
  `reminder_time` int(10) NOT NULL,
  `reminder_sent` int(2) NOT NULL,
  PRIMARY KEY (`activity_id`),
  CONSTRAINT `vtiger_activity_reminder_ibfk_1` FOREIGN KEY (`activity_id`) REFERENCES `vtiger_activity` (`activityid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_activity_reminder_popup`;
CREATE TABLE `vtiger_activity_reminder_popup` (
  `reminderid` int(10) NOT NULL AUTO_INCREMENT,
  `recordid` int(10) NOT NULL,
  `datetime` datetime NOT NULL,
  `status` int(2) NOT NULL,
  PRIMARY KEY (`reminderid`),
  KEY `recordid` (`recordid`),
  CONSTRAINT `vtiger_activity_reminder_popup_ibfk_1` FOREIGN KEY (`recordid`) REFERENCES `vtiger_activity` (`activityid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=20460 DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_activity_update_dates`;
CREATE TABLE `vtiger_activity_update_dates` (
  `activityid` int(10) NOT NULL,
  `parent` int(10) NOT NULL,
  `task_id` int(10) NOT NULL,
  PRIMARY KEY (`activityid`),
  KEY `parent` (`parent`),
  KEY `vtiger_activity_update_dates_ibfk_1` (`task_id`),
  CONSTRAINT `vtiger_activity_update_dates_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `com_vtiger_workflowtasks` (`task_id`) ON DELETE CASCADE,
  CONSTRAINT `vtiger_activity_update_dates_ibfk_2` FOREIGN KEY (`parent`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `vtiger_activity_update_dates_ibfk_3` FOREIGN KEY (`activityid`) REFERENCES `vtiger_activity` (`activityid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_activitycf`;
CREATE TABLE `vtiger_activitycf` (
  `activityid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`activityid`),
  CONSTRAINT `vtiger_activitycf_ibfk_1` FOREIGN KEY (`activityid`) REFERENCES `vtiger_activity` (`activityid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_assetscf`;
CREATE TABLE `vtiger_assetscf` (
  `assetsid` int(10) NOT NULL,
  PRIMARY KEY (`assetsid`),
  CONSTRAINT `vtiger_assetscf_ibfk_1` FOREIGN KEY (`assetsid`) REFERENCES `vtiger_assets` (`assetsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_salesmanattachmentsrel`;
CREATE TABLE `vtiger_salesmanattachmentsrel` (
  `smid` int(10) NOT NULL DEFAULT '0',
  `attachmentsid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`smid`,`attachmentsid`),
  KEY `salesmanattachmentsrel_smid_idx` (`smid`),
  KEY `salesmanattachmentsrel_attachmentsid_idx` (`attachmentsid`),
  CONSTRAINT `fk_2_vtiger_salesmanattachmentsrel` FOREIGN KEY (`attachmentsid`) REFERENCES `vtiger_attachments` (`attachmentsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_callhistorycf`;
CREATE TABLE `vtiger_callhistorycf` (
  `callhistoryid` int(10) NOT NULL,
  PRIMARY KEY (`callhistoryid`),
  CONSTRAINT `vtiger_callhistorycf_ibfk_1` FOREIGN KEY (`callhistoryid`) REFERENCES `vtiger_callhistory` (`callhistoryid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_campanafacebookcf`;
CREATE TABLE `vtiger_campanafacebookcf` (
  `campanafacebookid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`campanafacebookid`),
  CONSTRAINT `fk_1_vtiger_campanafacebookcfcampanafacebookid` FOREIGN KEY (`campanafacebookid`) REFERENCES `vtiger_campanafacebook` (`campanafacebookid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_campanasmktdigitalcf`;
CREATE TABLE `vtiger_campanasmktdigitalcf` (
  `campanasmktdigitalid` int(11) NOT NULL,
  PRIMARY KEY (`campanasmktdigitalid`),
  CONSTRAINT `fk_1_vtiger_campanasmktdigitalcfcampanasmktdigitalid` FOREIGN KEY (`campanasmktdigitalid`) REFERENCES `vtiger_campanasmktdigital` (`campanasmktdigitalid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_cargofijocf`;
CREATE TABLE `vtiger_cargofijocf` (
  `cargofijoid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`cargofijoid`),
  CONSTRAINT `fk_1_vtiger_cargofijocfcargofijoid` FOREIGN KEY (`cargofijoid`) REFERENCES `vtiger_cargofijo` (`cargofijoid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_clientecf`;
CREATE TABLE `vtiger_clientecf` (
  `clienteid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`clienteid`),
  CONSTRAINT `fk_1_vtiger_clientecfclienteid` FOREIGN KEY (`clienteid`) REFERENCES `vtiger_cliente` (`clienteid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_clientesgarantiacf`;
CREATE TABLE `vtiger_clientesgarantiacf` (
  `clientesgarantiaid` int(11) NOT NULL,
  PRIMARY KEY (`clientesgarantiaid`),
  CONSTRAINT `fk_1_vtiger_clientesgarantiacfclientesgarantiaid` FOREIGN KEY (`clientesgarantiaid`) REFERENCES `vtiger_clientesgarantia` (`clientesgarantiaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_contactaddress`;
CREATE TABLE `vtiger_contactaddress` (
  `contactaddressid` int(10) NOT NULL DEFAULT '0',
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel1b` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel2b` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel3b` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel4b` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel5b` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel6b` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel7b` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `addresslevel8b` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `buildingnumberb` varchar(100) DEFAULT NULL,
  `localnumberb` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  `poboxb` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`contactaddressid`),
  CONSTRAINT `fk_1_vtiger_contactaddress` FOREIGN KEY (`contactaddressid`) REFERENCES `vtiger_contactdetails` (`contactid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_contactscf`;
CREATE TABLE `vtiger_contactscf` (
  `contactid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`contactid`),
  CONSTRAINT `fk_1_vtiger_contactscf` FOREIGN KEY (`contactid`) REFERENCES `vtiger_contactdetails` (`contactid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_contactsubdetails`;
CREATE TABLE `vtiger_contactsubdetails` (
  `contactsubscriptionid` int(10) NOT NULL DEFAULT '0',
  `birthday` date DEFAULT NULL,
  `laststayintouchrequest` int(10) DEFAULT '0',
  `laststayintouchsavedate` int(10) DEFAULT '0',
  `leadsource` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`contactsubscriptionid`),
  CONSTRAINT `fk_1_vtiger_contactsubdetails` FOREIGN KEY (`contactsubscriptionid`) REFERENCES `vtiger_contactdetails` (`contactid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_customerdetails`;
CREATE TABLE `vtiger_customerdetails` (
  `customerid` int(10) NOT NULL,
  `portal` smallint(1) DEFAULT NULL,
  `support_start_date` date DEFAULT NULL,
  `support_end_date` date DEFAULT NULL,
  PRIMARY KEY (`customerid`),
  CONSTRAINT `fk_1_vtiger_customerdetails` FOREIGN KEY (`customerid`) REFERENCES `vtiger_contactdetails` (`contactid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_conveniocf`;
CREATE TABLE `vtiger_conveniocf` (
  `convenioid` int(11) NOT NULL,
  PRIMARY KEY (`convenioid`),
  CONSTRAINT `fk_1_vtiger_conveniocfconvenioid` FOREIGN KEY (`convenioid`) REFERENCES `vtiger_convenio` (`convenioid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_creditocf`;
CREATE TABLE `vtiger_creditocf` (
  `creditoid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`creditoid`),
  CONSTRAINT `fk_1_vtiger_creditocfcreditoid` FOREIGN KEY (`creditoid`) REFERENCES `vtiger_credito` (`creditoid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacoberturacf`;
CREATE TABLE `vtiger_demandacoberturacf` (
  `demandacoberturaid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`demandacoberturaid`),
  CONSTRAINT `fk_1_vtiger_demandacoberturacfdemandacoberturaid` FOREIGN KEY (`demandacoberturaid`) REFERENCES `vtiger_demandacobertura` (`demandacoberturaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacobranzaclientescf`;
CREATE TABLE `vtiger_demandacobranzaclientescf` (
  `demandacobranzaclientesid` int(11) NOT NULL,
  PRIMARY KEY (`demandacobranzaclientesid`),
  CONSTRAINT `fk_1_vtiger_demandacobranzaclientescfdemandacobranzaclientesid` FOREIGN KEY (`demandacobranzaclientesid`) REFERENCES `vtiger_demandacobranzaclientes` (`demandacobranzaclientesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacolectivacf`;
CREATE TABLE `vtiger_demandacolectivacf` (
  `demandacolectivaid` int(11) NOT NULL,
  PRIMARY KEY (`demandacolectivaid`),
  CONSTRAINT `fk_1_vtiger_demandacolectivacfdemandacolectivaid` FOREIGN KEY (`demandacolectivaid`) REFERENCES `vtiger_demandacolectiva` (`demandacolectivaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_demandacomercialcf`;
CREATE TABLE `vtiger_demandacomercialcf` (
  `demandacomercialid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`demandacomercialid`),
  CONSTRAINT `fk_1_vtiger_demandacomercialcfdemandacomercialid` FOREIGN KEY (`demandacomercialid`) REFERENCES `vtiger_demandacomercial` (`demandacomercialid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_detallecobrosypagoscf`;
CREATE TABLE `vtiger_detallecobrosypagoscf` (
  `detallecobrosypagosid` int(11) NOT NULL,
  PRIMARY KEY (`detallecobrosypagosid`),
  CONSTRAINT `fk_1_vtiger_detallecobrosypagoscfdetallecobrosypagosid` FOREIGN KEY (`detallecobrosypagosid`) REFERENCES `vtiger_detallecobrosypagos` (`detallecobrosypagosid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_faqcf`;
CREATE TABLE `vtiger_faqcf` (
  `faqid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`faqid`),
  CONSTRAINT `fk_1_vtiger_faqcf` FOREIGN KEY (`faqid`) REFERENCES `vtiger_faq` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_faqcomments`;
CREATE TABLE `vtiger_faqcomments` (
  `commentid` int(10) NOT NULL AUTO_INCREMENT,
  `faqid` int(10) DEFAULT NULL,
  `comments` text,
  `createdtime` datetime NOT NULL,
  PRIMARY KEY (`commentid`),
  KEY `faqcomments_faqid_idx` (`faqid`),
  CONSTRAINT `fk_1_vtiger_faqcomments` FOREIGN KEY (`faqid`) REFERENCES `vtiger_faq` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_gestcomddacf`;
CREATE TABLE `vtiger_gestcomddacf` (
  `gestcomddaid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`gestcomddaid`),
  CONSTRAINT `fk_1_vtiger_gestcomddacfgestcomddaid` FOREIGN KEY (`gestcomddaid`) REFERENCES `vtiger_gestcomdda` (`gestcomddaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_gestionllamadacf`;
CREATE TABLE `vtiger_gestionllamadacf` (
  `gestionllamadaid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`gestionllamadaid`),
  CONSTRAINT `fk_1_vtiger_gestionllamadacfgestionllamadaid` FOREIGN KEY (`gestionllamadaid`) REFERENCES `vtiger_gestionllamada` (`gestionllamadaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_gestionrrsscf`;
CREATE TABLE `vtiger_gestionrrsscf` (
  `gestionrrssid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`gestionrrssid`),
  CONSTRAINT `fk_1_vtiger_gestionrrsscfgestionrrssid` FOREIGN KEY (`gestionrrssid`) REFERENCES `vtiger_gestionrrss` (`gestionrrssid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_holidaysentitlementcf`;
CREATE TABLE `vtiger_holidaysentitlementcf` (
  `holidaysentitlementid` int(10) NOT NULL,
  PRIMARY KEY (`holidaysentitlementid`),
  CONSTRAINT `fk_1_vtiger_holidaysentitlementcf` FOREIGN KEY (`holidaysentitlementid`) REFERENCES `vtiger_holidaysentitlement` (`holidaysentitlementid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ideascf`;
CREATE TABLE `vtiger_ideascf` (
  `ideasid` int(10) NOT NULL,
  PRIMARY KEY (`ideasid`),
  CONSTRAINT `fk_1_vtiger_ideascf` FOREIGN KEY (`ideasid`) REFERENCES `vtiger_ideas` (`ideasid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_leadaddress`;
CREATE TABLE `vtiger_leadaddress` (
  `leadaddressid` int(10) NOT NULL DEFAULT '0',
  `phone` varchar(50) DEFAULT NULL,
  `mobile` varchar(50) DEFAULT NULL,
  `fax` varchar(50) DEFAULT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  `phone_extra` varchar(100) DEFAULT NULL,
  `mobile_extra` varchar(100) DEFAULT NULL,
  `fax_extra` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`leadaddressid`),
  CONSTRAINT `fk_1_vtiger_leadaddress` FOREIGN KEY (`leadaddressid`) REFERENCES `vtiger_leaddetails` (`leadid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_leadscf`;
CREATE TABLE `vtiger_leadscf` (
  `leadid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`leadid`),
  CONSTRAINT `fk_1_vtiger_leadscf` FOREIGN KEY (`leadid`) REFERENCES `vtiger_leaddetails` (`leadid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_leadsubdetails`;
CREATE TABLE `vtiger_leadsubdetails` (
  `leadsubscriptionid` int(10) NOT NULL DEFAULT '0',
  `website` varchar(255) DEFAULT NULL,
  `callornot` int(1) DEFAULT '0',
  `readornot` int(1) DEFAULT '0',
  `empct` int(10) DEFAULT '0',
  PRIMARY KEY (`leadsubscriptionid`),
  CONSTRAINT `fk_1_vtiger_leadsubdetails` FOREIGN KEY (`leadsubscriptionid`) REFERENCES `vtiger_leaddetails` (`leadid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_lettersincf`;
CREATE TABLE `vtiger_lettersincf` (
  `lettersinid` int(10) NOT NULL,
  `internal_notes` text,
  `public_notes` text,
  PRIMARY KEY (`lettersinid`),
  CONSTRAINT `fk_1_vtiger_lettersincf` FOREIGN KEY (`lettersinid`) REFERENCES `vtiger_lettersin` (`lettersinid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_lettersoutcf`;
CREATE TABLE `vtiger_lettersoutcf` (
  `lettersoutid` int(10) NOT NULL,
  PRIMARY KEY (`lettersoutid`),
  CONSTRAINT `fk_1_vtiger_lettersoutcf` FOREIGN KEY (`lettersoutid`) REFERENCES `vtiger_lettersout` (`lettersoutid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_modcommentscf`;
CREATE TABLE `vtiger_modcommentscf` (
  `modcommentsid` int(10) NOT NULL,
  PRIMARY KEY (`modcommentsid`),
  CONSTRAINT `vtiger_modcommentscf_ibfk_1` FOREIGN KEY (`modcommentsid`) REFERENCES `vtiger_modcomments` (`modcommentsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_notescf`;
CREATE TABLE `vtiger_notescf` (
  `notesid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`notesid`),
  CONSTRAINT `vtiger_notescf_ibfk_1` FOREIGN KEY (`notesid`) REFERENCES `vtiger_notes` (`notesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_senotesrel`;
CREATE TABLE `vtiger_senotesrel` (
  `crmid` int(10) NOT NULL DEFAULT '0',
  `notesid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`crmid`,`notesid`),
  KEY `senotesrel_notesid_idx` (`notesid`),
  KEY `senotesrel_crmid_idx` (`crmid`),
  CONSTRAINT `fk_2_vtiger_senotesrel` FOREIGN KEY (`notesid`) REFERENCES `vtiger_notes` (`notesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossemployeescf`;
CREATE TABLE `vtiger_ossemployeescf` (
  `ossemployeesid` int(10) NOT NULL,
  PRIMARY KEY (`ossemployeesid`),
  CONSTRAINT `fk_1_vtiger_ossemployeescf` FOREIGN KEY (`ossemployeesid`) REFERENCES `vtiger_ossemployees` (`ossemployeesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossmailview_files`;
CREATE TABLE `vtiger_ossmailview_files` (
  `ossmailviewid` int(10) NOT NULL,
  `documentsid` int(10) NOT NULL,
  `attachmentsid` int(10) NOT NULL,
  KEY `fk_1_vtiger_ossmailview_files` (`ossmailviewid`),
  KEY `documentsid` (`documentsid`),
  CONSTRAINT `fk_1_vtiger_ossmailview_files` FOREIGN KEY (`ossmailviewid`) REFERENCES `vtiger_ossmailview` (`ossmailviewid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossmailview_relation`;
CREATE TABLE `vtiger_ossmailview_relation` (
  `ossmailviewid` int(10) NOT NULL,
  `crmid` int(10) NOT NULL,
  `date` datetime DEFAULT NULL,
  `deleted` tinyint(1) DEFAULT '0',
  UNIQUE KEY `ossmailviewid_2` (`ossmailviewid`,`crmid`),
  KEY `ossmailviewid` (`ossmailviewid`),
  KEY `crmid` (`crmid`,`deleted`),
  CONSTRAINT `vtiger_ossmailview_relation_ibfk_1` FOREIGN KEY (`ossmailviewid`) REFERENCES `vtiger_ossmailview` (`ossmailviewid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossmailviewcf`;
CREATE TABLE `vtiger_ossmailviewcf` (
  `ossmailviewid` int(10) NOT NULL,
  PRIMARY KEY (`ossmailviewid`),
  CONSTRAINT `fk_1_vtiger_ossmailviewcf` FOREIGN KEY (`ossmailviewid`) REFERENCES `vtiger_ossmailview` (`ossmailviewid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ossoutsourcedservicescf`;
CREATE TABLE `vtiger_ossoutsourcedservicescf` (
  `ossoutsourcedservicesid` int(10) NOT NULL,
  PRIMARY KEY (`ossoutsourcedservicesid`),
  CONSTRAINT `fk_1_vtiger_ossoutsourcedservicescf` FOREIGN KEY (`ossoutsourcedservicesid`) REFERENCES `vtiger_ossoutsourcedservices` (`ossoutsourcedservicesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_osspasswordscf`;
CREATE TABLE `vtiger_osspasswordscf` (
  `osspasswordsid` int(10) NOT NULL,
  PRIMARY KEY (`osspasswordsid`),
  CONSTRAINT `fk_1_vtiger_osspasswordscf` FOREIGN KEY (`osspasswordsid`) REFERENCES `vtiger_osspasswords` (`osspasswordsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_osssoldservicescf`;
CREATE TABLE `vtiger_osssoldservicescf` (
  `osssoldservicesid` int(10) NOT NULL,
  PRIMARY KEY (`osssoldservicesid`),
  CONSTRAINT `fk_1_vtiger_osssoldservicescf` FOREIGN KEY (`osssoldservicesid`) REFERENCES `vtiger_osssoldservices` (`osssoldservicesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_osstimecontrolcf`;
CREATE TABLE `vtiger_osstimecontrolcf` (
  `osstimecontrolid` int(10) NOT NULL,
  PRIMARY KEY (`osstimecontrolid`),
  CONSTRAINT `vtiger_osstimecontrolcf` FOREIGN KEY (`osstimecontrolid`) REFERENCES `vtiger_osstimecontrol` (`osstimecontrolid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_outsourcedproductscf`;
CREATE TABLE `vtiger_outsourcedproductscf` (
  `outsourcedproductsid` int(10) NOT NULL,
  PRIMARY KEY (`outsourcedproductsid`),
  CONSTRAINT `fk_1_vtiger_outsourcedproductscf` FOREIGN KEY (`outsourcedproductsid`) REFERENCES `vtiger_outsourcedproducts` (`outsourcedproductsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_paymentsincf`;
CREATE TABLE `vtiger_paymentsincf` (
  `paymentsinid` int(10) NOT NULL,
  PRIMARY KEY (`paymentsinid`),
  CONSTRAINT `fk_1_vtiger_paymentsincf` FOREIGN KEY (`paymentsinid`) REFERENCES `vtiger_paymentsin` (`paymentsinid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_paymentsoutcf`;
CREATE TABLE `vtiger_paymentsoutcf` (
  `paymentsoutid` int(10) NOT NULL,
  PRIMARY KEY (`paymentsoutid`),
  CONSTRAINT `fk_1_vtiger_paymentsoutcf` FOREIGN KEY (`paymentsoutid`) REFERENCES `vtiger_paymentsout` (`paymentsoutid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pbxmanagercf`;
CREATE TABLE `vtiger_pbxmanagercf` (
  `pbxmanagerid` int(10) NOT NULL,
  PRIMARY KEY (`pbxmanagerid`),
  CONSTRAINT `vtiger_pbxmanagercf_ibfk_1` FOREIGN KEY (`pbxmanagerid`) REFERENCES `vtiger_pbxmanager` (`pbxmanagerid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_preaprobacioncredicf`;
CREATE TABLE `vtiger_preaprobacioncredicf` (
  `preaprobacioncrediid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`preaprobacioncrediid`),
  CONSTRAINT `fk_1_vtiger_preaprobacioncredicfpreaprobacioncrediid` FOREIGN KEY (`preaprobacioncrediid`) REFERENCES `vtiger_preaprobacioncredi` (`preaprobacioncrediid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pricebookcf`;
CREATE TABLE `vtiger_pricebookcf` (
  `pricebookid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`pricebookid`),
  CONSTRAINT `fk_1_vtiger_pricebookcf` FOREIGN KEY (`pricebookid`) REFERENCES `vtiger_pricebook` (`pricebookid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pricebookproductrel`;
CREATE TABLE `vtiger_pricebookproductrel` (
  `pricebookid` int(10) NOT NULL,
  `productid` int(10) NOT NULL,
  `listprice` decimal(28,8) DEFAULT NULL,
  `usedcurrency` int(10) NOT NULL DEFAULT '1',
  PRIMARY KEY (`pricebookid`,`productid`),
  KEY `pricebookproductrel_pricebookid_idx` (`pricebookid`),
  KEY `pricebookproductrel_productid_idx` (`productid`),
  CONSTRAINT `fk_1_vtiger_pricebookproductrel` FOREIGN KEY (`pricebookid`) REFERENCES `vtiger_pricebook` (`pricebookid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_activityproductrel`;
CREATE TABLE `vtiger_activityproductrel` (
  `activityid` int(10) NOT NULL DEFAULT '0',
  `productid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`activityid`,`productid`),
  KEY `activityproductrel_activityid_idx` (`activityid`),
  KEY `activityproductrel_productid_idx` (`productid`),
  CONSTRAINT `fk_2_vtiger_activityproductrel` FOREIGN KEY (`productid`) REFERENCES `vtiger_products` (`productid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_productcf`;
CREATE TABLE `vtiger_productcf` (
  `productid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`productid`),
  CONSTRAINT `fk_1_vtiger_productcf` FOREIGN KEY (`productid`) REFERENCES `vtiger_products` (`productid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_seproductsrel`;
CREATE TABLE `vtiger_seproductsrel` (
  `crmid` int(10) NOT NULL DEFAULT '0',
  `productid` int(10) NOT NULL DEFAULT '0',
  `setype` varchar(30) NOT NULL,
  `rel_created_user` int(10) NOT NULL,
  `rel_created_time` datetime NOT NULL,
  `rel_comment` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`crmid`,`productid`),
  KEY `seproductsrel_productid_idx` (`productid`),
  KEY `seproductrel_crmid_idx` (`crmid`),
  CONSTRAINT `fk_2_vtiger_seproductsrel` FOREIGN KEY (`productid`) REFERENCES `vtiger_products` (`productid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projectcf`;
CREATE TABLE `vtiger_projectcf` (
  `projectid` int(10) NOT NULL,
  PRIMARY KEY (`projectid`),
  CONSTRAINT `vtiger_projectcf_ibfk_1` FOREIGN KEY (`projectid`) REFERENCES `vtiger_project` (`projectid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projectmilestonecf`;
CREATE TABLE `vtiger_projectmilestonecf` (
  `projectmilestoneid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`projectmilestoneid`),
  CONSTRAINT `vtiger_projectmilestonecf_ibfk_1` FOREIGN KEY (`projectmilestoneid`) REFERENCES `vtiger_projectmilestone` (`projectmilestoneid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_projecttaskcf`;
CREATE TABLE `vtiger_projecttaskcf` (
  `projecttaskid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`projecttaskid`),
  CONSTRAINT `vtiger_projecttaskcf_ibfk_1` FOREIGN KEY (`projecttaskid`) REFERENCES `vtiger_projecttask` (`projecttaskid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pruebademandacomercialcf`;
CREATE TABLE `vtiger_pruebademandacomercialcf` (
  `pruebademandacomercialid` int(11) NOT NULL,
  PRIMARY KEY (`pruebademandacomercialid`),
  CONSTRAINT `fk_1_vtiger_pruebademandacomercialcfpruebademandacomercialid` FOREIGN KEY (`pruebademandacomercialid`) REFERENCES `vtiger_pruebademandacomercial` (`pruebademandacomercialid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_pruebadocumentoscf`;
CREATE TABLE `vtiger_pruebadocumentoscf` (
  `pruebadocumentosid` int(11) NOT NULL,
  PRIMARY KEY (`pruebadocumentosid`),
  CONSTRAINT `fk_1_vtiger_pruebadocumentoscfpruebadocumentosid` FOREIGN KEY (`pruebadocumentosid`) REFERENCES `vtiger_pruebadocumentos` (`pruebadocumentosid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reconocimientodeudacf`;
CREATE TABLE `vtiger_reconocimientodeudacf` (
  `reconocimientodeudaid` int(11) NOT NULL,
  PRIMARY KEY (`reconocimientodeudaid`),
  CONSTRAINT `fk_1_vtiger_reconocimientodeudacfreconocimientodeudaid` FOREIGN KEY (`reconocimientodeudaid`) REFERENCES `vtiger_reconocimientodeuda` (`reconocimientodeudaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reservationscf`;
CREATE TABLE `vtiger_reservationscf` (
  `reservationsid` int(10) NOT NULL,
  PRIMARY KEY (`reservationsid`),
  CONSTRAINT `vtiger_reservationscf` FOREIGN KEY (`reservationsid`) REFERENCES `vtiger_reservations` (`reservationsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_servicecf`;
CREATE TABLE `vtiger_servicecf` (
  `serviceid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`serviceid`),
  CONSTRAINT `vtiger_servicecf_ibfk_1` FOREIGN KEY (`serviceid`) REFERENCES `vtiger_service` (`serviceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_servicecontractscf`;
CREATE TABLE `vtiger_servicecontractscf` (
  `servicecontractsid` int(10) NOT NULL,
  PRIMARY KEY (`servicecontractsid`),
  CONSTRAINT `vtiger_servicecontractscf_ibfk_1` FOREIGN KEY (`servicecontractsid`) REFERENCES `vtiger_servicecontracts` (`servicecontractsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_siniestrocf`;
CREATE TABLE `vtiger_siniestrocf` (
  `siniestroid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`siniestroid`),
  CONSTRAINT `fk_1_vtiger_siniestrocfsiniestroid` FOREIGN KEY (`siniestroid`) REFERENCES `vtiger_siniestro` (`siniestroid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_smsnotifiercf`;
CREATE TABLE `vtiger_smsnotifiercf` (
  `smsnotifierid` int(10) NOT NULL,
  PRIMARY KEY (`smsnotifierid`),
  CONSTRAINT `vtiger_smsnotifiercf_ibfk_1` FOREIGN KEY (`smsnotifierid`) REFERENCES `vtiger_smsnotifier` (`smsnotifierid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_solicituddecreditocf`;
CREATE TABLE `vtiger_solicituddecreditocf` (
  `solicituddecreditoid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`solicituddecreditoid`),
  CONSTRAINT `fk_1_vtiger_solicituddecreditocfsolicituddecreditoid` FOREIGN KEY (`solicituddecreditoid`) REFERENCES `vtiger_solicituddecredito` (`solicituddecreditoid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_solitudsiniestroscf`;
CREATE TABLE `vtiger_solitudsiniestroscf` (
  `solitudsiniestrosid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`solitudsiniestrosid`),
  CONSTRAINT `fk_1_vtiger_solitudsiniestroscfsolitudsiniestrosid` FOREIGN KEY (`solitudsiniestrosid`) REFERENCES `vtiger_solitudsiniestros` (`solitudsiniestrosid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_subidadocumentoscf`;
CREATE TABLE `vtiger_subidadocumentoscf` (
  `subidadocumentosid` int(11) NOT NULL,
  PRIMARY KEY (`subidadocumentosid`),
  CONSTRAINT `fk_1_vtiger_subidadocumentoscfsubidadocumentosid` FOREIGN KEY (`subidadocumentosid`) REFERENCES `vtiger_subidadocumentos` (`subidadocumentosid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripcioncf`;
CREATE TABLE `vtiger_suscripcioncf` (
  `suscripcionid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`suscripcionid`),
  CONSTRAINT `fk_1_vtiger_suscripcioncfsuscripcionid` FOREIGN KEY (`suscripcionid`) REFERENCES `vtiger_suscripcion` (`suscripcionid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripcionddacf`;
CREATE TABLE `vtiger_suscripcionddacf` (
  `suscripcionddaid` int(11) NOT NULL,
  PRIMARY KEY (`suscripcionddaid`),
  CONSTRAINT `fk_1_vtiger_suscripcionddacfsuscripcionddaid` FOREIGN KEY (`suscripcionddaid`) REFERENCES `vtiger_suscripciondda` (`suscripcionddaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_suscripciondemandacf`;
CREATE TABLE `vtiger_suscripciondemandacf` (
  `suscripciondemandaid` int(11) NOT NULL,
  PRIMARY KEY (`suscripciondemandaid`),
  CONSTRAINT `fk_1_vtiger_suscripciondemandacfsuscripciondemandaid` FOREIGN KEY (`suscripciondemandaid`) REFERENCES `vtiger_suscripciondemanda` (`suscripciondemandaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_seticketsrel`;
CREATE TABLE `vtiger_seticketsrel` (
  `crmid` int(10) NOT NULL DEFAULT '0',
  `ticketid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`crmid`,`ticketid`),
  KEY `seticketsrel_crmid_idx` (`crmid`),
  KEY `seticketsrel_ticketid_idx` (`ticketid`),
  CONSTRAINT `fk_2_vtiger_seticketsrel` FOREIGN KEY (`ticketid`) REFERENCES `vtiger_troubletickets` (`ticketid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ticketcf`;
CREATE TABLE `vtiger_ticketcf` (
  `ticketid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ticketid`),
  CONSTRAINT `fk_1_vtiger_ticketcf` FOREIGN KEY (`ticketid`) REFERENCES `vtiger_troubletickets` (`ticketid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_vendoraddress`;
CREATE TABLE `vtiger_vendoraddress` (
  `vendorid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel1b` varchar(255) DEFAULT NULL,
  `addresslevel1c` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel2b` varchar(255) DEFAULT NULL,
  `addresslevel2c` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel3b` varchar(255) DEFAULT NULL,
  `addresslevel3c` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel4b` varchar(255) DEFAULT NULL,
  `addresslevel4c` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel5b` varchar(255) DEFAULT NULL,
  `addresslevel5c` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel6b` varchar(255) DEFAULT NULL,
  `addresslevel6c` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel7b` varchar(255) DEFAULT NULL,
  `addresslevel7c` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `addresslevel8b` varchar(255) DEFAULT NULL,
  `addresslevel8c` varchar(255) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  `poboxb` varchar(50) DEFAULT NULL,
  `poboxc` varchar(50) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `buildingnumberb` varchar(100) DEFAULT NULL,
  `buildingnumberc` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `localnumberb` varchar(100) DEFAULT NULL,
  `localnumberc` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`vendorid`),
  CONSTRAINT `vtiger_vendoraddress_ibfk_1` FOREIGN KEY (`vendorid`) REFERENCES `vtiger_vendor` (`vendorid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_vendorcf`;
CREATE TABLE `vtiger_vendorcf` (
  `vendorid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`vendorid`),
  CONSTRAINT `fk_1_vtiger_vendorcf` FOREIGN KEY (`vendorid`) REFERENCES `vtiger_vendor` (`vendorid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_vendorcontactrel`;
CREATE TABLE `vtiger_vendorcontactrel` (
  `vendorid` int(10) NOT NULL DEFAULT '0',
  `contactid` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`vendorid`,`contactid`),
  KEY `vendorcontactrel_vendorid_idx` (`vendorid`),
  KEY `vendorcontactrel_contact_idx` (`contactid`),
  CONSTRAINT `fk_2_vtiger_vendorcontactrel` FOREIGN KEY (`vendorid`) REFERENCES `vtiger_vendor` (`vendorid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ventadedemandascf`;
CREATE TABLE `vtiger_ventadedemandascf` (
  `ventadedemandasid` int(11) NOT NULL,
  PRIMARY KEY (`ventadedemandasid`),
  CONSTRAINT `fk_1_vtiger_ventadedemandascfventadedemandasid` FOREIGN KEY (`ventadedemandasid`) REFERENCES `vtiger_ventadedemandas` (`ventadedemandasid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_ventademandascf`;
CREATE TABLE `vtiger_ventademandascf` (
  `ventademandasid` int(11) NOT NULL,
  PRIMARY KEY (`ventademandasid`),
  CONSTRAINT `fk_1_vtiger_ventademandascfventademandasid` FOREIGN KEY (`ventademandasid`) REFERENCES `vtiger_ventademandas` (`ventademandasid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_relcriteria_grouping`;
CREATE TABLE `vtiger_relcriteria_grouping` (
  `groupid` int(10) NOT NULL,
  `queryid` int(10) NOT NULL,
  `group_condition` varchar(256) DEFAULT NULL,
  `condition_expression` text,
  PRIMARY KEY (`groupid`,`queryid`),
  KEY `queryid` (`queryid`),
  CONSTRAINT `vtiger_relcriteria_grouping_ibfk_1` FOREIGN KEY (`queryid`) REFERENCES `vtiger_relcriteria` (`queryid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportdatefilter`;
CREATE TABLE `vtiger_reportdatefilter` (
  `datefilterid` int(10) NOT NULL,
  `datecolumnname` varchar(250) DEFAULT '',
  `datefilter` varchar(250) DEFAULT '',
  `startdate` date DEFAULT NULL,
  `enddate` date DEFAULT NULL,
  PRIMARY KEY (`datefilterid`),
  KEY `reportdatefilter_datefilterid_idx` (`datefilterid`),
  CONSTRAINT `fk_1_vtiger_reportdatefilter` FOREIGN KEY (`datefilterid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportgroupbycolumn`;
CREATE TABLE `vtiger_reportgroupbycolumn` (
  `reportid` int(10) DEFAULT NULL,
  `sortid` int(10) DEFAULT NULL,
  `sortcolname` varchar(250) DEFAULT NULL,
  `dategroupbycriteria` varchar(250) DEFAULT NULL,
  KEY `fk_1_vtiger_reportgroupbycolumn` (`reportid`),
  CONSTRAINT `fk_1_vtiger_reportgroupbycolumn` FOREIGN KEY (`reportid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportmodules`;
CREATE TABLE `vtiger_reportmodules` (
  `reportmodulesid` int(10) NOT NULL,
  `primarymodule` varchar(50) NOT NULL DEFAULT '',
  `secondarymodules` varchar(250) DEFAULT '',
  PRIMARY KEY (`reportmodulesid`),
  CONSTRAINT `fk_1_vtiger_reportmodules` FOREIGN KEY (`reportmodulesid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportsortcol`;
CREATE TABLE `vtiger_reportsortcol` (
  `sortcolid` int(10) NOT NULL,
  `reportid` int(10) NOT NULL,
  `columnname` varchar(250) DEFAULT '',
  `sortorder` varchar(250) DEFAULT 'Asc',
  PRIMARY KEY (`sortcolid`,`reportid`),
  KEY `fk_1_vtiger_reportsortcol` (`reportid`),
  CONSTRAINT `fk_1_vtiger_reportsortcol` FOREIGN KEY (`reportid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_reportsummary`;
CREATE TABLE `vtiger_reportsummary` (
  `reportsummaryid` int(10) NOT NULL,
  `summarytype` int(10) NOT NULL,
  `columnname` varchar(250) NOT NULL DEFAULT '',
  PRIMARY KEY (`reportsummaryid`,`summarytype`,`columnname`),
  KEY `reportsummary_reportsummaryid_idx` (`reportsummaryid`),
  CONSTRAINT `fk_1_vtiger_reportsummary` FOREIGN KEY (`reportsummaryid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_scheduled_reports`;
CREATE TABLE `vtiger_scheduled_reports` (
  `reportid` int(10) NOT NULL,
  `recipients` text,
  `schedule` text,
  `format` varchar(10) DEFAULT NULL,
  `next_trigger_time` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`reportid`),
  CONSTRAINT `vtiger_scheduled_reports_ibfk_1` FOREIGN KEY (`reportid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_schedulereports`;
CREATE TABLE `vtiger_schedulereports` (
  `reportid` int(10) DEFAULT NULL,
  `scheduleid` int(3) DEFAULT NULL,
  `recipients` text,
  `schdate` varchar(20) DEFAULT NULL,
  `schtime` time DEFAULT NULL,
  `schdayoftheweek` varchar(100) DEFAULT NULL,
  `schdayofthemonth` varchar(100) DEFAULT NULL,
  `schannualdates` varchar(500) DEFAULT NULL,
  `specificemails` varchar(500) DEFAULT NULL,
  `next_trigger_time` timestamp NULL DEFAULT NULL,
  `filetype` varchar(20) DEFAULT NULL,
  KEY `reportid` (`reportid`),
  CONSTRAINT `vtiger_schedulereports_ibfk_1` FOREIGN KEY (`reportid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `u_yf_featured_filter`;
CREATE TABLE `u_yf_featured_filter` (
  `user` varchar(30) NOT NULL,
  `cvid` int(10) NOT NULL,
  PRIMARY KEY (`user`,`cvid`),
  KEY `cvid` (`cvid`),
  KEY `user` (`user`),
  CONSTRAINT `u_yf_featured_filter_ibfk_1` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_customaction`;
CREATE TABLE `vtiger_customaction` (
  `cvid` int(10) NOT NULL,
  `subject` varchar(250) NOT NULL,
  `module` varchar(50) NOT NULL,
  `content` text,
  KEY `customaction_cvid_idx` (`cvid`),
  CONSTRAINT `fk_1_vtiger_customaction` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_cvadvfilter`;
CREATE TABLE `vtiger_cvadvfilter` (
  `cvid` int(10) NOT NULL,
  `columnindex` int(10) NOT NULL,
  `columnname` varchar(250) DEFAULT '',
  `comparator` varchar(20) DEFAULT NULL,
  `value` varchar(512) DEFAULT NULL,
  `groupid` int(10) DEFAULT '1',
  `column_condition` varchar(255) DEFAULT 'and',
  PRIMARY KEY (`cvid`,`columnindex`),
  KEY `cvadvfilter_cvid_idx` (`cvid`),
  CONSTRAINT `fk_1_vtiger_cvadvfilter` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_cvcolumnlist`;
CREATE TABLE `vtiger_cvcolumnlist` (
  `cvid` int(10) NOT NULL,
  `columnindex` int(10) NOT NULL,
  `columnname` varchar(250) DEFAULT '',
  PRIMARY KEY (`cvid`,`columnindex`),
  KEY `cvcolumnlist_columnindex_idx` (`columnindex`),
  KEY `cvcolumnlist_cvid_idx` (`cvid`),
  CONSTRAINT `fk_1_vtiger_cvcolumnlist` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

DROP TABLE IF EXISTS `vtiger_cvstdfilter`;
CREATE TABLE `vtiger_cvstdfilter` (
  `cvid` int(10) NOT NULL,
  `columnname` varchar(250) DEFAULT '',
  `stdfilter` varchar(250) DEFAULT '',
  `startdate` date DEFAULT NULL,
  `enddate` date DEFAULT NULL,
  PRIMARY KEY (`cvid`),
  KEY `cvstdfilter_cvid_idx` (`cvid`),
  CONSTRAINT `fk_1_vtiger_cvstdfilter` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;;

