From 1525f0f9167828125d103f8380cdf7c5c7ce2c51 Mon Sep 17 00:00:00 2001 From: KlausBai <89413584+KlausBai@users.noreply.github.com> Date: Fri, 29 Apr 2022 17:29:15 +0800 Subject: [PATCH] fix: mysql hasColumn Error.(hasColumn `a_id` but hasColumn('a_Id') is false) (#5148) --- lib/dialects/mysql/schema/mysql-compiler.js | 4 ++-- test/integration2/schema/misc.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dialects/mysql/schema/mysql-compiler.js b/lib/dialects/mysql/schema/mysql-compiler.js index 9330e4795f..7b84bacdbf 100644 --- a/lib/dialects/mysql/schema/mysql-compiler.js +++ b/lib/dialects/mysql/schema/mysql-compiler.js @@ -48,8 +48,8 @@ class SchemaCompiler_MySQL extends SchemaCompiler { output(resp) { return resp.some((row) => { return ( - this.client.wrapIdentifier(row.Field) === - this.client.wrapIdentifier(column) + this.client.wrapIdentifier(row.Field.toLowerCase()) === + this.client.wrapIdentifier(column.toLowerCase()) ); }); }, diff --git a/test/integration2/schema/misc.spec.js b/test/integration2/schema/misc.spec.js index 3f663eab35..3f754faa29 100644 --- a/test/integration2/schema/misc.spec.js +++ b/test/integration2/schema/misc.spec.js @@ -1661,9 +1661,9 @@ describe('Schema (misc)', () => { expect(exists).to.equal(true); })); - describe('sqlite only', () => { + describe('sqlite and mysql only', () => { it('checks whether a column exists without being case sensitive, resolving with a boolean', async function () { - if (!isSQLite(knex)) { + if (!isSQLite(knex)&& !isMysql(knex)) { return this.skip(); }