feat: refs #6738 crear las Fk de la tabla flight #2054

Merged
robert merged 26 commits from 6738-cleanTables2008Part2to2 into dev 2024-04-05 11:51:22 +00:00
14 changed files with 129 additions and 9 deletions

View File

@ -156,16 +156,16 @@ INSERT INTO `vn`.`occupationCode` (`code`, `name`)
('b', 'Representantes de comercio'),
('c', 'Personal de oficios en trabajos de construcción en general, y en instalac.,edificios y obras');
INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`nss`,`codpuesto`,`codempresa`,`codcontrato`,`FAntiguedad`,`grupotarifa`,`codcategoria`,`ContratoTemporal`)
INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`codempresa`)
VALUES
(36,'46/10515497-58',6,20,189,'2009-01-02',5,10,0),
(43,'46/10235353-50',7,20,189,'2009-04-21',5,10,0),
(76,'46/10250562-30',1,20,189,'2009-09-07',9,5,0),
(1106,'46/10297768-94',4,20,100,'2021-03-09',7,18,0),
(1107,'46/1627085-11',15,20,402,'2021-03-15',9,6,1),
(1108,'46/10446901-41',25,20,502,'2021-03-22',10,29,1),
(1109,'46/10552113-8',3,20,402,'2021-03-23',9,9,1),
(1110,'46/10723579-75',3,20,402,'2021-03-23',9,9,1);
(36,20),
(43,20),
(76,20),
(1106,20),
(1107,20),
(1108,20),
(1109,20),
(1110,20);
INSERT INTO `vn`.`trainingCourseType` (`id`, `name`)
VALUES

View File

@ -0,0 +1,5 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Proveedores_cargueras`
AS SELECT `fs`.`supplierFk` AS `Id_Proveedor`
FROM `vn`.`supplierFreight` `fs`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Tramos`
AS SELECT `s`.`id` AS `id`,
`s`.`section` AS `Tramo`
FROM `vn`.`timeSlots` `s`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_employee`
AS SELECT `pw`.`workerFkA3` AS `CodTrabajador`,
`pw`.`companyFkA3` AS `codempresa`
FROM `vn`.`payrollWorker` `pw`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_centros`
AS SELECT `pwc`.`workCenterFkA3` AS `cod_centro`,
`pwc`.`companyFkA3` AS `codempresa`
FROM `vn`.`payrollWorkCenter` `pwc`

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_conceptos`
AS SELECT `pc`.`id` AS `conceptoid`,
`pc`.`name` AS `concepto`,
`pc`.`isSalaryAgreed` AS `isSalaryAgreed`,
`pc`.`isVariable` AS `isVariable`,
`pc`.`isException` AS `isException`
FROM `vn`.`payrollComponent` `pc`

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn.flight ADD CONSTRAINT flight_airline_FK FOREIGN KEY (airlineFk)
REFERENCES vn.airline(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.`timeSlots`;
robert marked this conversation as resolved Outdated

primer revisa que realment es gasta, si ja ho has mirat chatGpt proposa timeSlots,
crec que es prou intuitiu

primer revisa que realment es gasta, si ja ho has mirat chatGpt proposa timeSlots, crec que es prou intuitiu
ALTER TABLE IF EXISTS `vn`.`timeSlots`
CHANGE COLUMN IF EXISTS `Tramo` `section` time NOT NULL;

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn2008`.`dock__`;
ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-03-05';

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.`supplierFreight`;
robert marked this conversation as resolved Outdated

jo crec que faria supplierFreight, en client tb ho tenim així, les taules que estan relacionades comencen per client.

jo crec que faria supplierFreight, en client tb ho tenim així, les taules que estan relacionades comencen per client.
ALTER TABLE IF EXISTS `vn`.`supplierFreight`
CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL;

View File

@ -0,0 +1,13 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`payroll_employee` RENAME `vn`.`payrollWorker`;
ALTER TABLE IF EXISTS `vn`.`payrollWorker`
CHANGE COLUMN IF EXISTS `CodTrabajador` `workerFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',
robert marked this conversation as resolved Outdated

hi ha dos comes? això myt push no dona fallo?

hi ha dos comes? això myt push no dona fallo?
CHANGE COLUMN IF EXISTS `nss` `nss__` varchar(23) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codpuesto` `codpuesto__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(10) NOT NULL COMMENT 'Columna que hace referencia a A3.',
CHANGE COLUMN IF EXISTS `codcontrato` `codcontrato__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `FAntiguedad` `FAntiguedad__` date NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `grupotarifa` `grupotarifa__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codcategoria` `codcategoria__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `ContratoTemporal` `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@Deprecated refs #6738 15/03/2024';

View File

@ -0,0 +1,13 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`payroll_centros` RENAME `vn`.`payrollWorkCenter`;
ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter`
Review

WorkCenter dona lloc a confusio que tindra una fk al workCenter pero no es així

WorkCenter dona lloc a confusio que tindra una fk al workCenter pero no es així
Review

Lo he comentado con Carlos y payrollWorkCenter le parece correcto, podrías decir cual seria un nombre correcto?

Lo he comentado con Carlos y payrollWorkCenter le parece correcto, podrías decir cual seria un nombre correcto?
CHANGE COLUMN IF EXISTS `cod_centro` `workCenterFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',
CHANGE COLUMN IF EXISTS `Centro` `Centro__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `nss_cotizacion` `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `domicilio` `domicilio__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `poblacion` `poblacion__` varchar(45) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `cp` `cp__` varchar(5) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `empresa_id` `empresa_id__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(11) DEFAULT NULL COMMENT 'Columna que hace referencia a A3.';
;

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`payroll_conceptos` RENAME `vn`.`payrollComponent`;
ALTER TABLE IF EXISTS `vn`.`payrollComponent`
CHANGE COLUMN IF EXISTS `conceptoid` `id` int(11) NOT NULL,
CHANGE COLUMN IF EXISTS `concepto` `name` varchar(255) DEFAULT NULL;

View File

@ -0,0 +1,40 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Tramos` AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.Tramos TO `employee`;
GRANT SELECT ON TABLE vn.timeSlots TO `employee`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Proveedores_cargueras` AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.Proveedores_cargueras TO `buyer`;
GRANT SELECT ON TABLE vn.supplierFreight TO `buyer`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_employee` AS
SELECT 1;
GRANT SELECT,INSERT ON TABLE vn2008.payroll_employee TO `hr`;
GRANT SELECT,INSERT ON TABLE vn.payrollWorker TO `hr`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_centros` AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.payroll_centros TO `hr`;
GRANT SELECT ON TABLE vn.payrollWorkCenter TO `hr`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_conceptos` AS
SELECT 1;
GRANT SELECT,UPDATE ON TABLE vn2008.payroll_conceptos TO `hr`;
GRANT SELECT,UPDATE ON TABLE vn.payrollComponent TO `hr`;