Skip to content

Commit

Permalink
fix: mysql hasColumn Error.(hasColumn a_id but hasColumn('a_Id') is…
Browse files Browse the repository at this point in the history
… false) (#5148)
  • Loading branch information
KlausBai committed Apr 29, 2022
1 parent d6da038 commit 1525f0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/dialects/mysql/schema/mysql-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
);
});
},
Expand Down
4 changes: 2 additions & 2 deletions test/integration2/schema/misc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 1525f0f

Please sign in to comment.