From 4d4143a4150ec24b3b0a57285445ac2a09d14b62 Mon Sep 17 00:00:00 2001 From: Santosh Bandichode Date: Thu, 16 Nov 2023 18:10:58 +0530 Subject: [PATCH] Allow double quotes around table name with mysql --- src/utils/getLastMigrationState.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/getLastMigrationState.ts b/src/utils/getLastMigrationState.ts index c4a36e8..5076b9f 100644 --- a/src/utils/getLastMigrationState.ts +++ b/src/utils/getLastMigrationState.ts @@ -8,6 +8,10 @@ import type { } from "../constants"; export default async function getLastMigrationState(sequelize: Sequelize) { + if (sequelize.getDialect() == 'mysql') { + await sequelize.query('SET SESSION SQL_MODE=ANSI_QUOTES;', { type: QueryTypes.RAW }); + } + const [lastExecutedMigration] = await sequelize.query( 'SELECT name FROM "SequelizeMeta" ORDER BY name desc limit 1', { type: QueryTypes.SELECT }