diff --git a/lib/dialects/sqlite3/schema/compiler.js b/lib/dialects/sqlite3/schema/compiler.js index ebc42aad..ca85fddb 100644 --- a/lib/dialects/sqlite3/schema/compiler.js +++ b/lib/dialects/sqlite3/schema/compiler.js @@ -29,8 +29,8 @@ SchemaCompiler_SQLite3.prototype.hasColumn = function(tableName, column) { output(resp) { return some(resp, (col) => { return ( - this.client.wrapIdentifier(col.name) === - this.client.wrapIdentifier(column) + this.client.wrapIdentifier(col.name.toLowerCase()) === + this.client.wrapIdentifier(column.toLowerCase()) ); }); }, diff --git a/test/integration/schema/index.js b/test/integration/schema/index.js index f34d9a39..7a3f2b77 100644 --- a/test/integration/schema/index.js +++ b/test/integration/schema/index.js @@ -1048,6 +1048,25 @@ module.exports = function(knex) { expect(exists).to.equal(true); }); }); + + describe('sqlite only', function() { + if ( + !knex || + !knex.client || + !/sqlite3/i.test(knex.client.driverName) + ) { + return Promise.resolve(); + } + + it('checks whether a column exists without being case sensitive, resolving with a boolean', async () => { + const exists = await knex.schema.hasColumn( + 'accounts', + 'FIRST_NAME' + ); + + expect(exists).to.equal(true); + }); + }); }); describe('using processorss', function() {