From a42e20bd5ff889eae6e00221e33a79173a0920ac Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 31 Jan 2024 10:35:50 +0100 Subject: [PATCH] refactor: refs #6690 Deleted views and dependences --- .../vn/views/expeditionPallet_Print.sql | 2 +- db/routines/vn2008/procedures/clean.sql | 4 -- db/routines/vn2008/views/Rutas_Master | 24 ------------ db/routines/vn2008/views/Rutas_Master.sql | 22 ----------- db/routines/vn2008/views/Rutas_monitor.sql | 18 --------- db/routines/vn2008/views/sharingcart.sql | 10 ----- db/routines/vn2008/views/sharingclient.sql | 9 ----- db/routines/vn2008/views/sms.sql | 12 ------ db/routines/vn2008/views/tarifas.sql | 11 ------ .../vn2008/views/ticketCreationData.sql | 9 ----- db/routines/vn2008/views/ticketMRW.sql | 38 ------------------- .../10858-yellowPaniculata/00-firstScript.sql | 4 ++ 12 files changed, 5 insertions(+), 158 deletions(-) delete mode 100644 db/routines/vn2008/views/Rutas_Master delete mode 100644 db/routines/vn2008/views/Rutas_Master.sql delete mode 100644 db/routines/vn2008/views/Rutas_monitor.sql delete mode 100644 db/routines/vn2008/views/sharingcart.sql delete mode 100644 db/routines/vn2008/views/sharingclient.sql delete mode 100644 db/routines/vn2008/views/sms.sql delete mode 100644 db/routines/vn2008/views/tarifas.sql delete mode 100644 db/routines/vn2008/views/ticketCreationData.sql delete mode 100644 db/routines/vn2008/views/ticketMRW.sql create mode 100644 db/versions/10858-yellowPaniculata/00-firstScript.sql diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql index 0a41c95da..4e9e8cb0e 100644 --- a/db/routines/vn/views/expeditionPallet_Print.sql +++ b/db/routines/vn/views/expeditionPallet_Print.sql @@ -31,7 +31,7 @@ FROM ( ) JOIN `vn`.`route` `r` ON(`r`.`id` = `t`.`routeFk`) ) - LEFT JOIN `vn2008`.`Rutas_monitor` `rm` ON(`rm`.`Id_Ruta` = `r`.`id`) + LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`) ) LEFT JOIN `vn`.`expeditionTruck` `et2` ON(`et2`.`id` = `rm`.`expeditionTruckFk`) ) diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index c2d2e34a0..f63edc80a 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -20,14 +20,12 @@ proc: BEGIN SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR; SET vRangeDeleteTicket = 60; - DELETE FROM Rutas_monitor WHERE fecha < vDate; DELETE FROM cdr WHERE calldate < vDate18; DELETE FROM Monitoring WHERE ODBC_TIME < vDate; DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < vDate; DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; - DELETE FROM sms WHERE DATE_ODBC < vDate18; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; @@ -47,8 +45,6 @@ proc: BEGIN JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate; DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; - DELETE FROM sharingcart where datEND < vDate; - DELETE FROM sharingclient where datEND < vDate; DELETE tt.* FROM Tickets_turno tt diff --git a/db/routines/vn2008/views/Rutas_Master b/db/routines/vn2008/views/Rutas_Master deleted file mode 100644 index 03b9cfc21..000000000 --- a/db/routines/vn2008/views/Rutas_Master +++ /dev/null @@ -1,24 +0,0 @@ - -CREATE OR REPLACE DEFINER = `root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Rutas_Master` -AS SELECT - `rm`.`id` AS `id`, - `rm`.`warehoseFk` AS `warehouse_id`, - `rm`.`km` AS `km`, - `rm`.`packages` AS `bultos`, - `rm`.`vehicleCost` AS `vehiculos_coste`, - `rm`.`staffCost` AS `personal_coste`, - `rm`.`vehicle` AS `vehiculos_numero`, - `rm`.`staff` AS `personal_numero`, - `rm`.`fuel` AS `gasoil`, - `rm`.`freelancers` AS `autonomos`, - `rm`.`year` AS `año`, - `rm`.`mounth` AS `mes`, - `rm`.`expense` AS `gastos`, - `rm`.`freelancersPackages` AS `bultos_autonomos`, - `rm`.`kmCost` AS `coste_km`, - `rm`.`packageCost` AS `coste_bulto`, - `rm`.`freelancerPackageCost` AS `coste_bulto_autonomo` , - `rm`.`created` AS `odbc_date` - FROM `vn`.`routeMaster` `rm` \ No newline at end of file diff --git a/db/routines/vn2008/views/Rutas_Master.sql b/db/routines/vn2008/views/Rutas_Master.sql deleted file mode 100644 index cdc2bedef..000000000 --- a/db/routines/vn2008/views/Rutas_Master.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Rutas_Master` -AS SELECT `rm`.`id` AS `id`, - `rm`.`warehouseFk` AS `warehouse_id`, - `rm`.`km` AS `km`, - `rm`.`packages` AS `bultos`, - `rm`.`vehicleCost` AS `vehiculos_coste`, - `rm`.`staffCost` AS `personal_coste`, - `rm`.`vehicle` AS `vehiculos_numero`, - `rm`.`staff` AS `personal_numero`, - `rm`.`fuel` AS `gasoil`, - `rm`.`freelancers` AS `autonomos`, - `rm`.`year` AS `año`, - `rm`.`month` AS `mes`, - `rm`.`expense` AS `gastos`, - `rm`.`freelancersPackages` AS `bultos_autonomos`, - `rm`.`kmCost` AS `coste_km`, - `rm`.`packageCost` AS `coste_bulto`, - `rm`.`freelancerPackageCost` AS `coste_bulto_autonomo`, - `rm`.`created` AS `odbc_date` -FROM `vn`.`routeMaster` `rm` diff --git a/db/routines/vn2008/views/Rutas_monitor.sql b/db/routines/vn2008/views/Rutas_monitor.sql deleted file mode 100644 index bd6daab4c..000000000 --- a/db/routines/vn2008/views/Rutas_monitor.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Rutas_monitor` -AS SELECT `vn`.`routesMonitor`.`routeFk` AS `Id_Ruta`, - `vn`.`routesMonitor`.`name` AS `name`, - `vn`.`routesMonitor`.`beachFk` AS `Ubicacion`, - `vn`.`routesMonitor`.`ticketPacked` AS `pedidosEncajados`, - `vn`.`routesMonitor`.`ticketFree` AS `pedidosLibres`, - `vn`.`routesMonitor`.`ticketProduction` AS `pedidosProduccion`, - `vn`.`routesMonitor`.`packages` AS `bultos`, - `vn`.`routesMonitor`.`note` AS `notas`, - `vn`.`routesMonitor`.`dated` AS `fecha`, - `vn`.`routesMonitor`.`dockFk` AS `dockFk`, - `vn`.`routesMonitor`.`m3` AS `m3`, - `vn`.`routesMonitor`.`priority` AS `priority`, - `vn`.`routesMonitor`.`etd` AS `etd`, - `vn`.`routesMonitor`.`expeditionTruckFk` AS `expeditionTruckFk` -FROM `vn`.`routesMonitor` diff --git a/db/routines/vn2008/views/sharingcart.sql b/db/routines/vn2008/views/sharingcart.sql deleted file mode 100644 index b59977b8f..000000000 --- a/db/routines/vn2008/views/sharingcart.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`sharingcart` -AS SELECT `sc`.`id` AS `id`, - `sc`.`workerFk` AS `Id_Trabajador`, - `sc`.`started` AS `datSTART`, - `sc`.`ended` AS `datEND`, - `sc`.`workerSubstitute` AS `Id_Suplente`, - `sc`.`created` AS `odbc_date` -FROM `vn`.`sharingCart` `sc` diff --git a/db/routines/vn2008/views/sharingclient.sql b/db/routines/vn2008/views/sharingclient.sql deleted file mode 100644 index 970132c80..000000000 --- a/db/routines/vn2008/views/sharingclient.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`sharingclient` -AS SELECT `sc`.`id` AS `id`, - `sc`.`workerFk` AS `Id_Trabajador`, - `sc`.`started` AS `datSTART`, - `sc`.`ended` AS `datEND`, - `sc`.`clientFk` AS `Id_Cliente` -FROM `vn`.`sharingClient` `sc` diff --git a/db/routines/vn2008/views/sms.sql b/db/routines/vn2008/views/sms.sql deleted file mode 100644 index abaea40a2..000000000 --- a/db/routines/vn2008/views/sms.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`sms` -AS SELECT `t`.`id` AS `id`, - `t`.`senderFk` AS `Id_trabajador`, - `t`.`sender` AS `from`, - `t`.`destination` AS `to`, - `t`.`message` AS `text`, - `t`.`statusCode` AS `sent`, - `t`.`status` AS `response`, - `t`.`created` AS `DATE_ODBC` -FROM `vn`.`sms` `t` diff --git a/db/routines/vn2008/views/tarifas.sql b/db/routines/vn2008/views/tarifas.sql deleted file mode 100644 index 8b836d60a..000000000 --- a/db/routines/vn2008/views/tarifas.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`tarifas` -AS SELECT `r`.`id` AS `tarifa_id`, - `r`.`dated` AS `fecha`, - `r`.`warehouseFk` AS `warehouse_id`, - `r`.`rate0` AS `t0`, - `r`.`rate1` AS `t1`, - `r`.`rate2` AS `t2`, - `r`.`rate3` AS `t3` -FROM `vn`.`rate` `r` diff --git a/db/routines/vn2008/views/ticketCreationData.sql b/db/routines/vn2008/views/ticketCreationData.sql deleted file mode 100644 index 5de86375d..000000000 --- a/db/routines/vn2008/views/ticketCreationData.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`ticketCreationData` -AS SELECT dayname(`h`.`confirm_date`) AS `DiadelaSemana`, - HOUR(`h`.`confirm_date`) AS `Hora`, - cast(`h`.`confirm_date` AS date) AS `Fecha`, - `h`.`source_app` AS `Dispositivo` -FROM `hedera`.`order` `h` -WHERE `h`.`confirm_date` <> 0 diff --git a/db/routines/vn2008/views/ticketMRW.sql b/db/routines/vn2008/views/ticketMRW.sql deleted file mode 100644 index 1173c5180..000000000 --- a/db/routines/vn2008/views/ticketMRW.sql +++ /dev/null @@ -1,38 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`ticketMRW` -AS SELECT `Tickets`.`Id_Agencia` AS `id_Agencia`, - `Tickets`.`empresa_id` AS `empresa_id`, - `Consignatarios`.`consignatario` AS `Consignatario`, - `Consignatarios`.`domicilio` AS `DOMICILIO`, - `Consignatarios`.`poblacion` AS `POBLACION`, - `Consignatarios`.`codPostal` AS `CODPOSTAL`, - `Consignatarios`.`telefono` AS `telefono`, - `Consignatarios`.`movil` AS `movil`, - `Clientes`.`if` AS `IF`, - `Tickets`.`Id_Ticket` AS `Id_Ticket`, - `Tickets`.`warehouse_id` AS `warehouse_id`, - `Consignatarios`.`id_consigna` AS `Id_Consigna`, - `Paises`.`Codigo` AS `CodigoPais`, - `Tickets`.`Fecha` AS `Fecha`, - `province`.`province_id` AS `province_id`, - `Tickets`.`landing` AS `landing` -FROM ( - ( - ( - ( - `vn2008`.`Clientes` - JOIN `vn2008`.`Consignatarios` ON( - `Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente` - ) - ) - JOIN `vn2008`.`Tickets` ON( - `Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna` - ) - ) - JOIN `vn2008`.`province` ON( - `Consignatarios`.`province_id` = `province`.`province_id` - ) - ) - JOIN `vn2008`.`Paises` ON(`province`.`Paises_Id` = `Paises`.`Id`) - ) diff --git a/db/versions/10858-yellowPaniculata/00-firstScript.sql b/db/versions/10858-yellowPaniculata/00-firstScript.sql new file mode 100644 index 000000000..b6642ed66 --- /dev/null +++ b/db/versions/10858-yellowPaniculata/00-firstScript.sql @@ -0,0 +1,4 @@ +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.Rutas_Master FROM productionAssi; +REVOKE SELECT ON TABLE vn2008.Rutas_monitor FROM employee; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.tarifas FROM buyer; +REVOKE SELECT, UPDATE ON TABLE vn2008.tarifas FROM buyerBoss; \ No newline at end of file