25 lines
847 B
SQL
25 lines
847 B
SQL
ALTER TABLE `postgresql`.`business` ADD payedHolidays INT NULL;
|
|
ALTER TABLE `postgresql`.`business` CHANGE payedHolidays payedHolidays INT NULL AFTER reasonEndFk;
|
|
|
|
CREATE OR REPLACE
|
|
ALGORITHM = UNDEFINED VIEW `vn`.`workerLabour` AS
|
|
select
|
|
`b`.`business_id` AS `businessFk`,
|
|
`p`.`id_trabajador` AS `workerFk`,
|
|
`bl`.`workcenter_id` AS `workCenterFk`,
|
|
`b`.`date_start` AS `started`,
|
|
`b`.`date_end` AS `ended`,
|
|
`d`.`id` AS `departmentFk`,
|
|
`b`.`payedHolidays` AS `payedHolidays`
|
|
from
|
|
((((`postgresql`.`person` `p`
|
|
join `postgresql`.`profile` `pr` on
|
|
((`pr`.`person_id` = `p`.`person_id`)))
|
|
join `postgresql`.`business` `b` on
|
|
((`b`.`client_id` = `pr`.`profile_id`)))
|
|
join `postgresql`.`business_labour` `bl` on
|
|
((`b`.`business_id` = `bl`.`business_id`)))
|
|
join `vn`.`department` `d` on
|
|
((`d`.`id` = `bl`.`department_id`)))
|
|
order by
|
|
`b`.`date_start` desc |