diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 67763066f..e97ee3626 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -18768,7 +18768,8 @@ DROP TABLE IF EXISTS `business`; CREATE TABLE `business` ( `business_id` int(11) NOT NULL AUTO_INCREMENT, `client_id` int(11) DEFAULT NULL, - `provider_id` int(11) DEFAULT NULL, + `provider_id__` int(11) DEFAULT NULL, + `companyCodeFk` char(3) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `date_start` date DEFAULT NULL, `date_end` date DEFAULT NULL, `workerBusiness` longtext, @@ -18777,11 +18778,11 @@ CREATE TABLE `business` ( `occupationCodeFk` varchar(1) DEFAULT NULL, PRIMARY KEY (`business_id`), KEY `business_client` (`client_id`), - KEY `bussiness_provider` (`provider_id`), KEY `business_occupationCodeFk` (`occupationCodeFk`), + KEY `business_companyCodeFk` (`companyCodeFk`), CONSTRAINT `business_client` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `business_occupationCodeFk` FOREIGN KEY (`occupationCodeFk`) REFERENCES `vn`.`occupationCode` (`code`) ON UPDATE CASCADE, - CONSTRAINT `bussiness_provider` FOREIGN KEY (`provider_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `vn`.`company` (`code`) ON UPDATE CASCADE, + CONSTRAINT `business_occupationCodeFk` FOREIGN KEY (`occupationCodeFk`) REFERENCES `vn`.`occupationCode` (`code`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -19032,13 +19033,14 @@ CREATE TABLE `income_employee` ( `haber` decimal(10,2) NOT NULL DEFAULT '0.00', `id_incomeType` int(11) DEFAULT NULL, `odbc_date` date DEFAULT NULL, - `person_id` int(11) DEFAULT NULL, + `workerFk` int(11) unsigned NOT NULL, + `person_id__` int(11) DEFAULT NULL, `concepto` longtext, PRIMARY KEY (`id`), - KEY `fperson_id` (`person_id`), KEY `income_employeeId_incomeType_idx` (`id_incomeType`), + KEY `income_employee_workerFk_idx` (`workerFk`), CONSTRAINT `income_employeeId_incomeType` FOREIGN KEY (`id_incomeType`) REFERENCES `vn2008`.`payroll_conceptos` (`conceptoid`) ON UPDATE CASCADE, - CONSTRAINT `income_employee_FK` FOREIGN KEY (`person_id`) REFERENCES `vn`.`person` (`id`) + CONSTRAINT `income_employee_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19263,12 +19265,14 @@ DROP TABLE IF EXISTS `profile`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile` ( `profile_id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL, + `person_id__` int(11) DEFAULT NULL, `profile_type_id` int(11) NOT NULL DEFAULT '1', + `workerFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`profile_id`), - KEY `profile_person_id_idx` (`person_id`), + KEY `profile_person_id_idx` (`person_id__`), KEY `profile_profile_type_id_idx` (`profile_type_id`), - CONSTRAINT `profile_FK` FOREIGN KEY (`person_id`) REFERENCES `vn`.`person` (`id`) + KEY `profile_workerFk_idx` (`workerFk`), + CONSTRAINT `profile_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29334,6 +29338,7 @@ CREATE TABLE `company` ( `phytosanitary` longtext COLLATE utf8_unicode_ci, `fhAdminNumber` int(11) DEFAULT NULL COMMENT 'número de cliente en FloraHolland', PRIMARY KEY (`id`), + UNIQUE KEY `companyCode_UNIQUE` (`code`), KEY `gerente_id` (`workerManagerFk`), KEY `empresa_cliente_idx` (`clientFk`), KEY `Id_Proveedores_account` (`supplierAccountFk`), @@ -36927,10 +36932,10 @@ CREATE TABLE `periodicityType` ( -- Table structure for table `person` -- -DROP TABLE IF EXISTS `person`; +DROP TABLE IF EXISTS `person__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `person` ( +CREATE TABLE `person__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `firstname` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `surnames` varchar(60) COLLATE utf8_unicode_ci NOT NULL, @@ -43363,22 +43368,10 @@ CREATE TABLE `worker` ( `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `password__` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `email__` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `extension__` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `sub` int(11) unsigned DEFAULT NULL, - `user__` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `typeBussines__` varchar(30) CHARACTER SET utf8 DEFAULT 'no dejar vacio' COMMENT 'campo obsoleto, actualmente se rellena en laboral', - `laborCategory__` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `started__` datetime DEFAULT NULL, - `ended__` datetime DEFAULT NULL, - `notes__` varchar(254) COLLATE utf8_unicode_ci DEFAULT NULL, `photo` blob, - `fi__` varchar(9) COLLATE utf8_unicode_ci DEFAULT NULL, - `address__` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `birthed__` date NOT NULL, - `phone` varchar(9) COLLATE utf8_unicode_ci NOT NULL, - `clientFk__` int(11) DEFAULT NULL, + `phone` varchar(9) COLLATE utf8_unicode_ci DEFAULT NULL, + `mobileExtension` int(4) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `bossFk` int(11) NOT NULL DEFAULT '103', `fiDueDate` datetime DEFAULT NULL, @@ -43392,17 +43385,20 @@ CREATE TABLE `worker` ( `originCountryFk` mediumint(8) unsigned DEFAULT NULL COMMENT 'País de origen', `educationLevelFk` smallint(6) DEFAULT NULL, `SSN` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `fi` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `birth` date DEFAULT NULL, + `isDisable` tinyint(1) NOT NULL DEFAULT '0', + `isFreelance` tinyint(1) NOT NULL DEFAULT '0', + `isSsDiscounted` tinyint(1) NOT NULL DEFAULT '0', + `sex` enum('M','F') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', PRIMARY KEY (`id`), UNIQUE KEY `CodigoTrabajador_UNIQUE` (`code`), - UNIQUE KEY `user` (`user__`), UNIQUE KEY `user_id_UNIQUE` (`userFk`), - UNIQUE KEY `Id_Cliente_Interno` (`clientFk__`), KEY `sub` (`sub`), KEY `boss_idx` (`bossFk`), KEY `worker_FK` (`labelerFk`), KEY `worker_FK_2` (`educationLevelFk`), KEY `worker_FK_1` (`originCountryFk`), - CONSTRAINT `Clientes` FOREIGN KEY (`clientFk__`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `educationLevel` (`id`) ON UPDATE CASCADE,