Skip to content

Commit 1525f0f

Browse files
authored
fix: mysql hasColumn Error.(hasColumn a_id but hasColumn('a_Id') is false) (knex#5148)
1 parent d6da038 commit 1525f0f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/dialects/mysql/schema/mysql-compiler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class SchemaCompiler_MySQL extends SchemaCompiler {
4848
output(resp) {
4949
return resp.some((row) => {
5050
return (
51-
this.client.wrapIdentifier(row.Field) ===
52-
this.client.wrapIdentifier(column)
51+
this.client.wrapIdentifier(row.Field.toLowerCase()) ===
52+
this.client.wrapIdentifier(column.toLowerCase())
5353
);
5454
});
5555
},

test/integration2/schema/misc.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1661,9 +1661,9 @@ describe('Schema (misc)', () => {
16611661
expect(exists).to.equal(true);
16621662
}));
16631663

1664-
describe('sqlite only', () => {
1664+
describe('sqlite and mysql only', () => {
16651665
it('checks whether a column exists without being case sensitive, resolving with a boolean', async function () {
1666-
if (!isSQLite(knex)) {
1666+
if (!isSQLite(knex)&& !isMysql(knex)) {
16671667
return this.skip();
16681668
}
16691669

0 commit comments

Comments
 (0)