From 5bef3989cd9a7e9accf6883ca1c5e18d13518e3c Mon Sep 17 00:00:00 2001 From: davidd Date: Wed, 21 Feb 2024 14:07:52 +0100 Subject: [PATCH] refs #6372 --- ...Label_afterUpdate.sql => saleLabel_afterUpdate.sql} | 4 ++-- db/routines/vn2008/views/movement_label.sql | 10 ---------- db/versions/10896-salmonOrchid/14-movement_label.sql | 6 ++++-- db/versions/10896-salmonOrchid/25-warehouse_pickup.sql | 4 +++- 4 files changed, 9 insertions(+), 15 deletions(-) rename db/routines/vn/triggers/{movementLabel_afterUpdate.sql => saleLabel_afterUpdate.sql} (56%) delete mode 100644 db/routines/vn2008/views/movement_label.sql diff --git a/db/routines/vn/triggers/movementLabel_afterUpdate.sql b/db/routines/vn/triggers/saleLabel_afterUpdate.sql similarity index 56% rename from db/routines/vn/triggers/movementLabel_afterUpdate.sql rename to db/routines/vn/triggers/saleLabel_afterUpdate.sql index 7dd8a9eb9..ff3787358 100644 --- a/db/routines/vn/triggers/movementLabel_afterUpdate.sql +++ b/db/routines/vn/triggers/saleLabel_afterUpdate.sql @@ -1,6 +1,6 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`movementLabel_afterUpdate` - AFTER UPDATE ON `vn`.`movementLabel` +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleLabel_afterUpdate` + AFTER UPDATE ON `vn`.`saleLabel` FOR EACH ROW IF NEW.stem >= (SELECT s.quantity FROM sale s WHERE s.id = NEW.saleFk) THEN UPDATE sale s SET s.isPicked = TRUE WHERE s.id = NEW.saleFk; diff --git a/db/routines/vn2008/views/movement_label.sql b/db/routines/vn2008/views/movement_label.sql deleted file mode 100644 index 738750507..000000000 --- a/db/routines/vn2008/views/movement_label.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`movement_label` -AS SELECT - `m`.`saleFk` AS `Id_movimiento`, - `m`.`label`, - `m`.`stem`, - `m`.`created` -FROM - `vn`.`movementLabel` `m`; \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/14-movement_label.sql b/db/versions/10896-salmonOrchid/14-movement_label.sql index 5ce130cf8..a3ccf320d 100644 --- a/db/versions/10896-salmonOrchid/14-movement_label.sql +++ b/db/versions/10896-salmonOrchid/14-movement_label.sql @@ -1,6 +1,8 @@ DROP TRIGGER IF EXISTS `vn2008`.`movement_label_afterUpdate`; -ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`movementLabel`; +DROP VIEW IF EXISTS `vn`.`saleLabel`; -ALTER TABLE IF EXISTS `vn`.`movementLabel` +ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`saleLabel`; + +ALTER TABLE IF EXISTS `vn`.`saleLabel` CHANGE COLUMN IF EXISTS `Id_movimiento` `saleFk` int(11) NOT NULL; diff --git a/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql b/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql index 1a2479a43..d6f2ae18d 100644 --- a/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql +++ b/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql @@ -2,4 +2,6 @@ ALTER TABLE IF EXISTS `vn2008`.`warehouse_pickup` RENAME `vn`.`warehousePickup`; ALTER TABLE IF EXISTS `vn`.`warehousePickup` CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(5) unsigned NOT NULL, -CHANGE COLUMN IF EXISTS `agency_id` `agencyModeFk` int(11) DEFAULT NULL; \ No newline at end of file +CHANGE COLUMN IF EXISTS `agency_id` `agencyModeFk` int(11) DEFAULT NULL; + +ALTER TABLE `vn`.`warehousePickup` COMMENT='Agencia de recogida para cada almacén';