#9477 update fixtures and structure

This commit is contained in:
Bernat 2019-01-24 14:15:08 +01:00
parent b7aa8e97a6
commit 6f316d54b4
8 changed files with 224 additions and 18 deletions

View File

@ -7,7 +7,7 @@ mysqldump --defaults-file=connect.ini --no-create-info salix ACL fieldAcl>> inst
echo "USE \`vn\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/dumpedFixtures.sql
echo "USE \`vn2008\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot department businessReasonEnd>> install/dump/dumpedFixtures.sql
echo "USE \`bi\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql
echo "USE \`cache\`;" >> install/dump/dumpedFixtures.sql
@ -15,4 +15,4 @@ mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/d
echo "USE \`hedera\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql
echo "USE \`postgresql\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info postgresql profile_type media_type >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info postgresql profile_type media_type professional_category labour_agreement calendar_labour_type workcenter>> install/dump/dumpedFixtures.sql

View File

@ -0,0 +1,29 @@
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `vn2008`.`department`;
CREATE TABLE `vn2008`.`department` (
`department_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
`lft` int(11) NOT NULL,
`rgt` int(11) NOT NULL,
`Id_Trabajador` int(11) DEFAULT NULL COMMENT 'Id_Trabajador es el jefe del departamento',
`company_id` int(11) NOT NULL,
`father_id` int(11) DEFAULT NULL,
`boss_id` int(11) DEFAULT NULL,
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL,
`production` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`department_id`),
UNIQUE KEY `lft_UNIQUE` (`lft`),
UNIQUE KEY `rgt_UNIQUE` (`rgt`),
UNIQUE KEY `name_UNIQUE` (`name`),
KEY `fk_department_Trabajadores1_idx` (`Id_Trabajador`),
KEY `dep_org_ibfk_3_idx` (`company_id`),
KEY `fk_department_department1_idx` (`father_id`),
KEY `fk_department_department1_idx_idx` (`father_id`),
CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE,
CONSTRAINT `fk_department_department1_idx` FOREIGN KEY (`father_id`) REFERENCES `department` (`department_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET FOREIGN_KEY_CHECKS=1;

View File

@ -0,0 +1,13 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `department` AS
SELECT
`b`.`department_id` AS `id`,
`b`.`name` AS `name`,
`b`.`father_id` AS `fatherFk`,
`b`.`production` AS `isProduction`
FROM
`vn2008`.`department` `b`;

View File

@ -0,0 +1,20 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`personDepartment` AS
SELECT
`p`.`id_trabajador` AS `id_trabajador`,
`p`.`name` AS `name`,
`p`.`firstname` AS `firstname`,
`d`.`name` AS `department`
FROM
(((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `pr` ON ((`pr`.`person_id` = `p`.`person_id`)))
LEFT JOIN (`postgresql`.`business` `b`
LEFT JOIN `postgresql`.`business_labour` `bl` ON ((`b`.`business_id` = `bl`.`business_id`))) ON ((`pr`.`profile_id` = `b`.`client_id`)))
JOIN `vn`.`department` `d` ON ((`d`.`id` = `bl`.`department_id`)))
WHERE
(ISNULL(`b`.`date_end`)
OR (`b`.`date_end` > CURDATE()));

View File

@ -0,0 +1,11 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`businessReasonEnd` AS
SELECT
`b`.`id` AS `id`,
`b`.`reason` AS `reason`
FROM
`vn2008`.`businessReasonEnd` `b`;

View File

@ -0,0 +1,13 @@
ALTER TABLE `postgresql`.`business_labour`
DROP FOREIGN KEY `business_labour_department`;
ALTER TABLE `postgresql`.`business_labour`
ADD INDEX `business_labour_department_idx` (`department_id` ASC);
ALTER TABLE `postgresql`.`business_labour`
ADD CONSTRAINT `business_labour_department`
FOREIGN KEY (`department_id`)
REFERENCES `vn2008`.`department` (`department_id`)
ON DELETE SET NULL
ON UPDATE CASCADE;

File diff suppressed because one or more lines are too long

View File

@ -1091,12 +1091,14 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`, `secret`, `caller_id`)
INSERT INTO `postgresql`.`person`(`person_id`, `name`, `nickname`, `nif`, `firstname`, `id_trabajador`)
VALUES
(1, 'Haller', 'DavidCharlesHaller', '53136686Q', 'David Charles', 106 ),
(2, 'Pym', 'HankPym', '09854837G', 'Hank', 107);
(2, 'Pym', 'HankPym', '09854837G', 'Hank', 107),
(3, 'VERDNATURA EVANTE SL', 'VNL', 'B78945612', NULL, NULL);
INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`)
VALUES
(1, 1, 1),
(2, 2, 1);
(2, 2, 1),
(3, 3, 6);
INSERT INTO `postgresql`.`media`(`media_id`, `media_type_id`, `value`, `sort`)
VALUES
@ -1108,4 +1110,14 @@ INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `medi
(1, 1, 1),
(2, 2, 2);
INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
VALUES
(1, 1, 3, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL +6 MONTH), 'E-46-12213123', NULL),
(2, 2, 3, DATE_ADD(CURDATE(), INTERVAL -10 DAY), NULL, 'E-46-87987933', NULL);
INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
VALUES
(1, NULL, 22, 4, 0, 1, 1, 1, 1),
(2, 'From las friday worker ownes the company 1 hour', 23, 1, 0, 1, 0, 1, 1);