diff --git a/db/changes/235201/02-views.sql b/db/changes/235201/02-views.sql index d399bb3b4..a0f41594d 100644 --- a/db/changes/235201/02-views.sql +++ b/db/changes/235201/02-views.sql @@ -32,3 +32,21 @@ AS SELECT `tt`.`id` AS `inter_id`, `tt`.`userFk` AS `Id_Trabajador`, `tt`.`supervisorFk` AS `Id_supervisor` FROM `vn`.`ticketTracking` `tt`; + +CREATE OR REPLACE +ALGORITHM = UNDEFINED VIEW `ticketStateToday` AS +SELECT + `ts`.`ticket` AS `ticket`, + `ts`.`state` AS `state`, + `ts`.`productionOrder` AS `productionOrder`, + `ts`.`alertLevel` AS `alertLevel`, + `ts`.`userFk` AS `userFk`, + `ts`.`code` AS `code`, + `ts`.`updated` AS `updated`, + `ts`.`isPicked` AS `isPicked` +FROM + (`ticketState` `ts` +JOIN `ticket` `t` ON + (`t`.`id` = `ts`.`ticket`)) +WHERE + `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`());