unstale

npm / knex

knex

What changed in knex 1 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

7 breaking1 security32 new APIs and options1 performance2 behavior and defaults2 tooling46 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

knex 354 changes

Breaking changes 3

  • Type definitions no longer allow calling knex without a table name.

    3.2.0release notes

  • Unexpected combinations of statements and clause groups are prevented from executing.

    3.2.0release notes

  • Drops compatibility for Node versions below 16.

    3.0.0release notes

Security 1

  • PostgreSQL searchPath values escape double quotes to prevent SQL injection.

    3.2.9release notes

New APIs and options 14

  • Adds a connectionPool option for using an external pool.

    3.3.0release notes

  • Adds knex.migrate.before for migration operations.

    3.3.0release notes

  • Adds knex.migrate.to for migration operations.

    3.3.0release notes

  • Adds MariaDB driver support.

    3.3.0release notes

  • Adds support for returning in MariaDB.

    3.3.0release notes

  • Adds support for token-credential in MSSQL authentication.

    3.3.0release notes

  • Relevant submodules are exposed for developers to use.

    3.2.1release notes

  • The better-sqlite3 dialect supports the defaultSafeIntegers option.

    3.2.0release notes

  • Added dropUniqueIfExists.

    3.2.0release notes

  • Migration lifecycle hooks were added, allowing developers to hook into migration execution.

    3.2.0release notes

  • A validate pool option was added.

    3.2.0release notes

  • A default datetime/timestamp precision setting was added for Postgres.

    3.2.0release notes

  • Added the SIMILAR TO operator.

    3.2.0release notes

  • SQLite transactions can set the foreign_keys pragma for a transaction.

    3.2.0release notes

Performance 1

Fixes and other changes 35

  • Preserves binding order in PostgreSQL and MSSQL delete and update queries.

    3.3.0release notes

  • Fixes SQLite conditional insert/merge when inserting multiple rows.

    3.3.0release notes

  • Sets error.cause for Tarn acquire connection errors.

    3.3.0release notes

  • Fixes FOR UPDATE OF when used with an explicit schema.

    3.3.0release notes

  • Fixes _setNullableState so it respects the schema.

    3.3.0release notes

  • Makes stream postProcessResponse errors catchable with .on('error').

    3.3.0release notes

  • Fixes an unhandled error on connection timeout with stream.

    3.3.0release notes

  • Preserves PostgreSQL updateFrom binding order.

    3.3.0release notes

  • Fixes the .where type regression for invalid types.

    3.3.0release notes

  • Aliases in analytic functions are now properly escaped.

    3.2.10release notes

  • Type definitions now support Array<Buffer>, which was already supported in code.

    3.2.9release notes

  • DELETE queries support LIMIT in dialects that support it, such as MySQL, while remaining disallowed in dialects that do not.

    3.2.9release notes

  • SQLite appends a RETURNING statement when inserting an empty row.

    3.2.9release notes

  • Reverts the exports map added in #6227.

    3.2.8release notes

  • Fixes TypeScript types for update with a subquery.

    3.2.8release notes

  • The client constructor clones configuration, preventing changes from being shared through the original config object.

    3.2.7release notes

  • Corrects binding order for deletes that use a subquery join.

    3.2.7release notes

  • MySQL renameColumn now handles lowercase INFORMATION_SCHEMA keys.

    3.2.7release notes

  • Fixes SQLite DDL operations failing inside transactions.

    3.2.7release notes

  • Fixed ESM exports.

    3.2.6release notes

  • Fixed ESM types.

    3.2.6release notes

  • Added type exports.

    3.2.6release notes

  • Knex can recover from a broken connection.

    3.2.0release notes

  • Fixed handling of the <=> operator, which MySQL does not permit.

    3.2.0release notes

  • The behavior of first when there are zero matches is specified.

    3.2.0release notes

  • Fixed migrate up behavior with a completed migration.

    3.2.0release notes

  • Postgres reports a clearer error when pg-query-stream is missing.

    3.2.0release notes

  • Support for safeIntegers in better-sqlite3 was improved.

    3.2.0release notes

  • MySQL support for upsert is documented.

    3.2.0release notes

  • Fixed where queries that use a raw column.

    3.2.0release notes

  • Fixed a whereILike issue with SQLite.

    3.2.0release notes

  • Fixes migrate:unlock when used with custom identifier wrapping.

    3.0.0release notes

  • Fixes the Knex type declarations to work with mixed modules.

    3.0.0release notes

  • Fixes driver options specified with .options() being ignored for the oracledb dialect.

    3.0.0release notes

  • Fixes the typing for raw bindings.

    3.0.0release notes

knex 21 changes

Fixes and other changes 1

knex 136 changes

Breaking changes 4

  • The Migrator consistently returns a list of migrations as objects.

    1.0.0release notes

  • Support for Node 10 was dropped.

    1.0.0release notes

  • The data structure returned by the RETURNING operation changed to be consistent with SELECT.

    1.0.0release notes

  • The unsupported sqlite3 driver was replaced with @vscode/sqlite3.

    1.0.0release notes

New APIs and options 18

Behavior and default changes 2

  • Set the MySQL comment size warning limit to 1024.

    1.0.0release notes

  • View columns are optional in create view like.

    1.0.0release notes

Tooling 2

Fixes and other changes 10

  • Fixed MySQL connection validation.

    1.0.0release notes

  • Fixed createViewOrReplace.

    1.0.0release notes

  • Fixed foreign key constraints when altering a SQLite table.

    1.0.0release notes

  • The indexType accepted by index creation can be a string.

    1.0.0release notes

  • Added missing integer typings.

    1.0.0release notes

  • Fixed insertion of the lock row during migration.

    1.0.0release notes

  • SQLite supports RETURNING statements with the better-sqlite3 driver.

    1.0.0release notes

  • Fixed a syntax error involving Union all and first.

    1.0.0release notes

  • Fixed an overzealous warning when whereNot is used with in or between.

    1.0.0release notes

  • SQLite .hasTable now enables wrapIdentifier.

    1.0.0release notes