From 014914e1d9aa3f4591589c5a4e844767333d16bd Mon Sep 17 00:00:00 2001 From: davidd Date: Fri, 8 Mar 2024 07:36:14 +0100 Subject: [PATCH 1/2] refs #6372 --- db/routines/bi/views/v_clientes_jerarquia.sql | 21 ------- db/routines/vn/views/unary.sql | 6 -- db/routines/vn/views/unaryScan.sql | 8 --- db/routines/vn/views/unaryScanLine.sql | 8 --- .../vn2008/procedures/unary_leaves.sql | 58 ------------------- db/routines/vn2008/procedures/unary_tops.sql | 19 ------ db/routines/vn2008/views/v_jerarquia.sql | 10 ---- .../10942-turquoiseCyca/00-firstScript.sql | 3 - .../10943-greenOrchid/00-firstScript.sql | 8 +-- 9 files changed, 4 insertions(+), 137 deletions(-) delete mode 100644 db/routines/bi/views/v_clientes_jerarquia.sql delete mode 100644 db/routines/vn/views/unary.sql delete mode 100644 db/routines/vn/views/unaryScan.sql delete mode 100644 db/routines/vn/views/unaryScanLine.sql delete mode 100644 db/routines/vn2008/procedures/unary_leaves.sql delete mode 100644 db/routines/vn2008/procedures/unary_tops.sql delete mode 100644 db/routines/vn2008/views/v_jerarquia.sql delete mode 100644 db/versions/10942-turquoiseCyca/00-firstScript.sql diff --git a/db/routines/bi/views/v_clientes_jerarquia.sql b/db/routines/bi/views/v_clientes_jerarquia.sql deleted file mode 100644 index e8e4e1e69..000000000 --- a/db/routines/bi/views/v_clientes_jerarquia.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `bi`.`v_clientes_jerarquia` -AS SELECT `c`.`id_cliente` AS `Id_Cliente`, - `c`.`cliente` AS `Cliente`, - `t`.`CodigoTrabajador` AS `Comercial`, - `tj`.`CodigoTrabajador` AS `Jefe` -FROM ( - ( - ( - `vn2008`.`Clientes` `c` - JOIN `vn2008`.`Trabajadores` `t` ON(`t`.`Id_Trabajador` = `c`.`Id_Trabajador`) - ) - JOIN `vn2008`.`jerarquia` ON( - `vn2008`.`jerarquia`.`worker_id` = `c`.`Id_Trabajador` - ) - ) - JOIN `vn2008`.`Trabajadores` `tj` ON( - `tj`.`Id_Trabajador` = `vn2008`.`jerarquia`.`boss_id` - ) - ) diff --git a/db/routines/vn/views/unary.sql b/db/routines/vn/views/unary.sql deleted file mode 100644 index 7f4c0d8c5..000000000 --- a/db/routines/vn/views/unary.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`unary` -AS SELECT `a`.`id` AS `id`, - `a`.`parent` AS `parent` -FROM `vn2008`.`unary` `a` diff --git a/db/routines/vn/views/unaryScan.sql b/db/routines/vn/views/unaryScan.sql deleted file mode 100644 index 18428dd62..000000000 --- a/db/routines/vn/views/unaryScan.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`unaryScan` -AS SELECT `u`.`unary_id` AS `unaryFk`, - `u`.`name` AS `name`, - `u`.`odbc_date` AS `created`, - `u`.`type` AS `type` -FROM `vn2008`.`unary_scan` `u` diff --git a/db/routines/vn/views/unaryScanLine.sql b/db/routines/vn/views/unaryScanLine.sql deleted file mode 100644 index 75aec7fed..000000000 --- a/db/routines/vn/views/unaryScanLine.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`unaryScanLine` -AS SELECT `u`.`id` AS `id`, - `u`.`code` AS `code`, - `u`.`odbc_date` AS `created`, - `u`.`unary_id` AS `unaryScanFk` -FROM `vn2008`.`unary_scan_line` `u` diff --git a/db/routines/vn2008/procedures/unary_leaves.sql b/db/routines/vn2008/procedures/unary_leaves.sql deleted file mode 100644 index 28b5baa76..000000000 --- a/db/routines/vn2008/procedures/unary_leaves.sql +++ /dev/null @@ -1,58 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_leaves`(v_top INT) -BEGIN -/** - * A partir de un nodo devuelve todos sus descendientes. - * - * @table tmp.tree Tabla con los ids de los nodos descendientes; - **/ - DECLARE v_count INT; - DECLARE v_parent INT; - DECLARE v_depth INT DEFAULT 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.tree; - CREATE TEMPORARY TABLE tmp.tree - (INDEX (id)) - ENGINE = MEMORY - SELECT v_top id, v_parent parent, v_depth depth; - - DROP TEMPORARY TABLE IF EXISTS tmp.parent; - CREATE TEMPORARY TABLE tmp.parent - ENGINE = MEMORY - SELECT v_top id; - - l: LOOP - - SET v_depth = v_depth + 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.child; - CREATE TEMPORARY TABLE tmp.child - ENGINE = MEMORY - SELECT c.`id`, c.parent - FROM `unary` c - JOIN tmp.parent p ON c.`parent` = p.id; - - DROP TEMPORARY TABLE tmp.parent; - CREATE TEMPORARY TABLE tmp.parent - ENGINE = MEMORY - SELECT c.id, c.parent - FROM tmp.child c - LEFT JOIN tmp.tree t ON t.id = c.id - WHERE t.id IS NULL; - - INSERT INTO tmp.tree - SELECT id, parent, v_depth FROM tmp.parent; - - SELECT COUNT(*) INTO v_count - FROM tmp.parent; - - IF v_count = 0 THEN - LEAVE l; - END IF; - END LOOP; - - DROP TEMPORARY TABLE - tmp.parent, - tmp.child; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/unary_tops.sql b/db/routines/vn2008/procedures/unary_tops.sql deleted file mode 100644 index b3a7cf11d..000000000 --- a/db/routines/vn2008/procedures/unary_tops.sql +++ /dev/null @@ -1,19 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_tops`() -BEGIN -/** - * Devuelve todos los nodos que no tienen padre. - * - * @table tmp.tree Tabla con los ids de los nodos que no tienen padre; - **/ - - DROP TEMPORARY TABLE IF EXISTS tmp.tree; - CREATE TEMPORARY TABLE tmp.tree - ENGINE = MEMORY - SELECT s.`unary_id` AS id, s.name, s.odbc_date, s.type - FROM `unary_scan` s - INNER JOIN `unary` u ON s.unary_id = u.id - WHERE u.parent IS NULL; - -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/views/v_jerarquia.sql b/db/routines/vn2008/views/v_jerarquia.sql deleted file mode 100644 index 6938a1fdf..000000000 --- a/db/routines/vn2008/views/v_jerarquia.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`v_jerarquia` -AS SELECT `vn2008`.`jerarquia`.`worker_id` AS `Id_Trabajador`, - `vn2008`.`jerarquia`.`boss_id` AS `boss_id` -FROM `vn2008`.`jerarquia` -UNION ALL -SELECT DISTINCT `vn2008`.`jerarquia`.`boss_id` AS `Id_Trabajador`, - `vn2008`.`jerarquia`.`boss_id` AS `boss_id` -FROM `vn2008`.`jerarquia` diff --git a/db/versions/10942-turquoiseCyca/00-firstScript.sql b/db/versions/10942-turquoiseCyca/00-firstScript.sql deleted file mode 100644 index 1b1ffca2f..000000000 --- a/db/versions/10942-turquoiseCyca/00-firstScript.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Place your SQL code here -ALTER TABLE IF EXISTS vn2008.unary__ RENAME vn2008.unary; -ALTER TABLE IF EXISTS vn2008.unary_scan__ RENAME vn2008.unary_scan; diff --git a/db/versions/10943-greenOrchid/00-firstScript.sql b/db/versions/10943-greenOrchid/00-firstScript.sql index d244c6762..c73903f65 100644 --- a/db/versions/10943-greenOrchid/00-firstScript.sql +++ b/db/versions/10943-greenOrchid/00-firstScript.sql @@ -1,4 +1,4 @@ -ALTER TABLE IF EXISTS vn2008.unary_scan__ RENAME vn2008.unary_scan; -ALTER TABLE IF EXISTS vn2008.unary_scan_line__ RENAME vn2008.unary_scan_line; -ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy__ RENAME vn2008.unary_scan_line_buy; -ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition__ RENAME vn2008.unary_scan_line_expedition; +ALTER TABLE IF EXISTS vn2008.unary_scan RENAME vn2008.unary_scan__; +ALTER TABLE IF EXISTS vn2008.unary_scan_line RENAME vn2008.unary_scan_line__; +ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy RENAME vn2008.unary_scan_line_buy__; +ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition RENAME vn2008.unary_scan_line_expedition__; From 60c50337ff83d6479e802cc0180e4c6d8d0f47c3 Mon Sep 17 00:00:00 2001 From: davidd Date: Fri, 8 Mar 2024 07:43:13 +0100 Subject: [PATCH 2/2] refs #6372 --- .../00-firstScript.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/versions/{10943-greenOrchid => 10946-blueChrysanthemum}/00-firstScript.sql (100%) diff --git a/db/versions/10943-greenOrchid/00-firstScript.sql b/db/versions/10946-blueChrysanthemum/00-firstScript.sql similarity index 100% rename from db/versions/10943-greenOrchid/00-firstScript.sql rename to db/versions/10946-blueChrysanthemum/00-firstScript.sql