From 1a9fc3728580f789727256d7893ca4bb90c16a50 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Tue, 1 Mar 2022 19:05:53 +0100 Subject: [PATCH] fix(MySQL): missing initial delimiter for exported procedures --- src/main/libs/clients/PostgreSQLClient.js | 1 - src/main/libs/exporters/sql/MysqlExporter.js | 4 ++-- src/renderer/components/ModalImportSchema.vue | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/libs/clients/PostgreSQLClient.js b/src/main/libs/clients/PostgreSQLClient.js index 2c6e5dd3..d666bccd 100644 --- a/src/main/libs/clients/PostgreSQLClient.js +++ b/src/main/libs/clients/PostgreSQLClient.js @@ -9,7 +9,6 @@ function pgToString (value) { return value.toString(); } -types.setTypeParser(20, a => parseInt(a));// bigint string to number types.setTypeParser(1082, pgToString); // date types.setTypeParser(1083, pgToString); // time types.setTypeParser(1114, pgToString); // timestamp diff --git a/src/main/libs/exporters/sql/MysqlExporter.js b/src/main/libs/exporters/sql/MysqlExporter.js index ead71923..1eca9ec4 100644 --- a/src/main/libs/exporters/sql/MysqlExporter.js +++ b/src/main/libs/exporters/sql/MysqlExporter.js @@ -205,7 +205,7 @@ ${footer} sqlString += 'DELIMITER ;;\n'; sqlString += '/*!50003 CREATE*/ '; sqlString += `/*!50017 DEFINER=${definer}*/ `; - sqlString += `/*!50003 TRIGGER \`${name}\` ${timing} ${event} ON ${table} FOR EACH ROW ${statement}*/;;\n`; + sqlString += `/*!50003 TRIGGER \`${name}\` ${timing} ${event} ON \`${table}\` FOR EACH ROW ${statement}*/;;\n`; sqlString += 'DELIMITER ;\n'; sqlString += '/*!50003 SET SQL_MODE=@OLD_SQL_MODE */;\n\n'; } @@ -316,7 +316,7 @@ ${footer} const procedureBody = createProcedure.substring(startOffset); let sqlString = 'DELIMITER ;;\n'; - sqlString = `/*!50003 DROP ${type} IF EXISTS ${name}*/;;\n`; + sqlString += `/*!50003 DROP ${type} IF EXISTS ${name}*/;;\n`; sqlString += '/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;;\n'; sqlString += `/*!50003 SET SQL_MODE="${sqlMode}"*/;;\n`; sqlString += `/*!50003 CREATE*/ /*!50020 DEFINER=${definer}*/ /*!50003 ${procedureBody}*/;;\n`; diff --git a/src/renderer/components/ModalImportSchema.vue b/src/renderer/components/ModalImportSchema.vue index 39c58130..729036d3 100644 --- a/src/renderer/components/ModalImportSchema.vue +++ b/src/renderer/components/ModalImportSchema.vue @@ -76,6 +76,7 @@ export default { }, methods: { ...mapActions({ + addNotification: 'notifications/addNotification', refreshSchema: 'workspaces/refreshSchema' }), async startImport (sqlFile) {