From 172e7566b53e70741afa01b45c3bd495cc2ba9a2 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 13 Mar 2024 11:58:25 +0100 Subject: [PATCH] refs #5858 perf: improve insert --- db/versions/10881-greenHydrangea/01-notification.vn.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/versions/10881-greenHydrangea/01-notification.vn.sql b/db/versions/10881-greenHydrangea/01-notification.vn.sql index 448435749..56ed069f4 100644 --- a/db/versions/10881-greenHydrangea/01-notification.vn.sql +++ b/db/versions/10881-greenHydrangea/01-notification.vn.sql @@ -1,12 +1,14 @@ INSERT IGNORE INTO util.notification ( `name`,`description`) VALUES -( 'zone-included','An email to notify zoneCollisions'); + ( 'zone-included','An email to notify zoneCollisions'); + +SET @DESTINATION_USER = "pepe"; SET @MaxId = LAST_INSERT_ID(); INSERT IGNORE INTO util.notificationSubscription (notificationFk,userFk) VALUES( - @MaxId, (SELECT id from `account`.`user` where name = "pepe")); + @MaxId, (SELECT id from `account`.`user` where name = @DESTINATION_USER)); INSERT IGNORE INTO util.notificationAcl (notificationFk,roleFk) - SELECT @MaxId, (SELECT role from `account`.`user` where name = "pepe") FROM util.notification WHERE name= "zone-included"; + SELECT @MaxId, (SELECT role from `account`.`user` where name = @DESTINATION_USER) FROM util.notification WHERE name= "zone-included";