mirror of
https://github.com/knex/knex.git
synced 2025-11-24 22:16:56 +00:00
Make sqlite3 hasColumn case insensitive (#3435)
This commit is contained in:
parent
115ff3c136
commit
0214f11663
@ -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())
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user