From 53a367f4b3064747a6160e7008af40ace0de55e8 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 8 Feb 2024 13:04:06 +0100 Subject: [PATCH 1/2] feat: refs #6371 cleanTablesFix --- db/routines/vn/views/agencyWarehouse.sql | 7 ------- db/routines/vn/views/clientDefaultCompany.sql | 9 -------- db/routines/vn/views/coolerPath.sql | 6 ------ db/routines/vn/views/grantGroup.sql | 7 ------- db/routines/vn2008/procedures/clean.sql | 8 ------- .../10876-goldenRoebelini/00-firstScript.sql | 21 +++++++++++++++++++ 6 files changed, 21 insertions(+), 37 deletions(-) delete mode 100644 db/routines/vn/views/agencyWarehouse.sql delete mode 100644 db/routines/vn/views/clientDefaultCompany.sql delete mode 100644 db/routines/vn/views/coolerPath.sql delete mode 100644 db/routines/vn/views/grantGroup.sql create mode 100644 db/versions/10876-goldenRoebelini/00-firstScript.sql diff --git a/db/routines/vn/views/agencyWarehouse.sql b/db/routines/vn/views/agencyWarehouse.sql deleted file mode 100644 index 6cb174544..000000000 --- a/db/routines/vn/views/agencyWarehouse.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`agencyWarehouse` -AS SELECT `a`.`agency_id` AS `agencyFk`, - `a`.`warehouse_id` AS `warehouseFk`, - `a`.`Vista` AS `agencyType` -FROM `vn2008`.`agency_warehouse` `a` diff --git a/db/routines/vn/views/clientDefaultCompany.sql b/db/routines/vn/views/clientDefaultCompany.sql deleted file mode 100644 index 6af418a1a..000000000 --- a/db/routines/vn/views/clientDefaultCompany.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`clientDefaultCompany` -AS SELECT `t`.`Id_Clientes_empresa` AS `id`, - `t`.`Id_Cliente` AS `clientFk`, - `t`.`empresa_id` AS `companyFk`, - `t`.`fecha_ini` AS `started`, - `t`.`fecha_fin` AS `finished` -FROM `vn2008`.`Clientes_empresa` `t` diff --git a/db/routines/vn/views/coolerPath.sql b/db/routines/vn/views/coolerPath.sql deleted file mode 100644 index 6be11e557..000000000 --- a/db/routines/vn/views/coolerPath.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`coolerPath` -AS SELECT `c`.`cooler_path_id` AS `id`, - `c`.`description` AS `description` -FROM `vn2008`.`cooler_path` `c` diff --git a/db/routines/vn/views/grantGroup.sql b/db/routines/vn/views/grantGroup.sql deleted file mode 100644 index 267c3154e..000000000 --- a/db/routines/vn/views/grantGroup.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`grantGroup` -AS SELECT `vn2008`.`Grupos`.`id` AS `id`, - `vn2008`.`Grupos`.`Grupo` AS `description`, - `vn2008`.`Grupos`.`observation_type_id` AS `observationTypeFk` -FROM `vn2008`.`Grupos` diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index bd8a324c6..8c36cced8 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -21,18 +21,10 @@ proc: BEGIN SET vRangeDeleteTicket = 60; DELETE FROM cdr WHERE calldate < vDate18; - DELETE FROM Monitoring WHERE ODBC_TIME < vDate; - DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM mail WHERE DATE_ODBC < vDate; - DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE ts - FROM Tickets_stack ts - JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; - DELETE tobs FROM ticket_observation tobs JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket diff --git a/db/versions/10876-goldenRoebelini/00-firstScript.sql b/db/versions/10876-goldenRoebelini/00-firstScript.sql new file mode 100644 index 000000000..361f3c7c8 --- /dev/null +++ b/db/versions/10876-goldenRoebelini/00-firstScript.sql @@ -0,0 +1,21 @@ +ALTER TABLE IF EXISTS vn2008.Compres_ok__ RENAME vn2008.Compres_ok; +ALTER TABLE IF EXISTS vn2008.Compres_ok COMMENT=''; + + +-- Para la tabla Monitoring +ALTER TABLE IF EXISTS vn2008.Monitoring RENAME vn2008.Monitoring__; +ALTER TABLE IF EXISTS vn2008.Monitoring__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Movimientos_avisar +ALTER TABLE IF EXISTS vn2008.Movimientos_avisar RENAME vn2008.Movimientos_avisar__; +ALTER TABLE IF EXISTS vn2008.Movimientos_avisar__ COMMENT='refs #6371 deprecated 2024-01-11'; + + +-- Para la tabla Movimientos_revisar +ALTER TABLE IF EXISTS vn2008.Movimientos_revisar RENAME vn2008.Movimientos_revisar__; +ALTER TABLE IF EXISTS vn2008.Movimientos_revisar__ COMMENT='refs #6371 deprecated 2024-01-11'; + + +-- Para la tabla Proveedores_escritos +ALTER TABLE IF EXISTS vn2008.Proveedores_escritos RENAME vn2008.Proveedores_escritos__; +ALTER TABLE IF EXISTS vn2008.Proveedores_escritos__ COMMENT='refs #6371 deprecated 2024-01-11'; \ No newline at end of file From 8a7441be57a1acef083159f6bbe7dc5491117db8 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 12 Feb 2024 11:14:17 +0100 Subject: [PATCH 2/2] feat: refs #6371 --- db/routines/vn2008/procedures/clean.sql | 7 ------- db/versions/10876-goldenRoebelini/00-firstScript.sql | 4 ---- 2 files changed, 11 deletions(-) diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index 8c36cced8..0ff185c46 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -56,13 +56,6 @@ proc: BEGIN JOIN travel t ON t.id = e.travel_id WHERE t.landing <= vDate; - DELETE co - FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE t.landing <= vDate; - DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1; - IF v_full THEN CREATE OR REPLACE TEMPORARY TABLE tTicketDelete SELECT DISTINCT tl.originFk ticketFk diff --git a/db/versions/10876-goldenRoebelini/00-firstScript.sql b/db/versions/10876-goldenRoebelini/00-firstScript.sql index 361f3c7c8..c089f8950 100644 --- a/db/versions/10876-goldenRoebelini/00-firstScript.sql +++ b/db/versions/10876-goldenRoebelini/00-firstScript.sql @@ -1,7 +1,3 @@ -ALTER TABLE IF EXISTS vn2008.Compres_ok__ RENAME vn2008.Compres_ok; -ALTER TABLE IF EXISTS vn2008.Compres_ok COMMENT=''; - - -- Para la tabla Monitoring ALTER TABLE IF EXISTS vn2008.Monitoring RENAME vn2008.Monitoring__; ALTER TABLE IF EXISTS vn2008.Monitoring__ COMMENT='refs #6371 deprecated 2024-01-11';