Releases: kysely-org/kysely
0.28.8
Hey π
A small batch of bug fixes. Please report any issues. π€π°π€
π Features
π Bugfixes
PostgreSQL π
- fix: filter schemas the current user does not have access to in postres introspector by @chanon in #1550
- fix: insert/update not being wrapped in parens when in CTE of a merge query. by @igalklebanov & @msifd in #1611
π Documentation
- chore: add SECURITY.md. by @igalklebanov in #1590
- fix: correct JSDoc type references in migration docs by @iyoshi-rgb in #1536
π¦ CICD & Tooling
- chore(ci): add dependency provenance check, bump deps to force check. by @igalklebanov in #1589
- chore: bumps dependencies. by @igalklebanov in #1600
- chore: bump deps. by @igalklebanov in #1612
β οΈ Breaking Changes
π€ New Contributors
- @chanon made their first contribution in #1550
- @iyoshi-rgb made their first contribution in #1536
- @msifd made their first contribution in #1611
Full Changelog: v0.28.7...v0.28.8
0.28.7
Hey π
A small batch of bug fixes. Please report any issues. π€π°π€
π Features
π Bugfixes
- fix: unexported dynamic builders resulting in ts(2742) when composite: true. by @igalklebanov in #1578
- fix(ExpressionBuilder): improper custom operator support in
eb()
. by @igalklebanov in #1579 - fix(TransactionBuilder): auto rollback only if transaction begun. by @igalklebanov in #1580
π Documentation
π¦ CICD & Tooling
β οΈ Breaking Changes
π€ New Contributors
Full Changelog: v0.28.6...v0.28.7
0.28.6
Hey π
A small batch of bug fixes. Please report any issues. π€π°π€
Docs site has been optimized and all we got was this animation:

π Features
π Bugfixes
PostgreSQL π / MSSQL π₯
- fix(WithSchemaTransformer): using table of merge into queries unhandled. by @alexander-azizi-martin in #1554.
MySQL π¬
- fix(dialect/mysql): compatibility with [email protected] by @jeengbe in #1574.
π Documentation
- docs: update site quotes section. by @igalklebanov in #1546.
- docs: add Execution flow page, and mermaid support. by @igalklebanov in #1548.
- docs: add kysely-supabase instructions. by @igalklebanov in #1555.
- docs: add llms.txt and llms-full.txt. by @igalklebanov in #1564.
- docs: add Sean's quote (Cal.com). by @igalklebanov in c1fd84d.
- docs: add vercel-analytics. by @igalklebanov in 1a21140.
- chore(docs): remove gtag. by @igalklebanov in 98e84f1.
- feat(docs): applying google fonts optimization. by @igalklebanov in #1566.
- chore(docs): clone packageManager property from root. by @igalklebanov in caa22f4.
- chore(docs): optimize demo video. by @igalklebanov in #1567.
- chore(docs): preload demo poster. by @igalklebanov in 3db3542.
- chore(docs): proper heading hierarchy. by @igalklebanov in 77eadc0.
- chore(docs): optimize avatars. by @igalklebanov in 45a010b.
- chore(docs): add meta description. by @igalklebanov in 8f4dd28.
- chore(docs): add LLMs docs page. by @igalklebanov in #1570.
π¦ CICD & Tooling
- chore: bump devDependencies, bump and pin github actions to commits, harden runners. by @igalklebanov in #1557.
- chore: bump typescript to 5.9, fix older TS tests, fix typings tests for pre-5.4. by @igalklebanov in #1538.
- chore(ci): typescript benchmark enhancements. by @igalklebanov in #1560.
- chore: bump deps, minor site fixes. by @igalklebanov in #1561.
- chore: remove broken bundle size badge from README. by @igalklebanov in 575c43a.
- chore: deny .only in mocha tests in CI only. by @igalklebanov in #1565.
- chore: bump deps. by @igalklebanov in #1577.
- pnpm 10.16. by @igalklebanov in c00319e.
- add keywords and homepage in package.json. by @igalklebanov in 163fcf4.
β οΈ Breaking Changes
π€ New Contributors
- @alexander-azizi-martin made their first contribution in #1554.
- @jeengbe made their first contribution in #1574.
Full Changelog: v0.28.5...v0.28.6
0.28.5
Hey π
A small batch of bug fixes. Please report any issues. π€π°π€
π Features
π Bugfixes
- fix:
Buffer
breakingShallowDehydrateValue
in non-Node.js TypeScript environments. by @igalklebanov in #1542.
π Documentation
π¦ CICD & Tooling
- chore(ci): pr comment typescript benchmark results. by @igalklebanov in #1540.
β οΈ Breaking Changes
π€ New Contributors
Full Changelog: v0.28.4...v0.28.5
0.28.4
Hey π
A small batch of bug fixes. Please report any issues. π€π°π€
π Features
π Bugfixes
- fix: ShallowDehydrateValue mishandles null & undefined, and bigint / numeric strings. by @igalklebanov in #1529
PostgreSQL π
π Documentation
π¦ CICD & Tooling
- chore: pnpm by @igalklebanov in #1527
- fix align-site-version script. by @igalklebanov in a9bcfa5
β οΈ Breaking Changes
π€ New Contributors
Full Changelog: v0.28.3...v0.28.4
0.28.3
Hey π
A small batch of bug fixes. Please report any issues. π€π°π€
π Features
- refactor: remove redundant queryId args. by @igalklebanov in #1483
CockroachDB π£
π Bugfixes
- fix(Migrator): NO_MIGRATIONS comparison fails in dup Kysely scenarios. by @igalklebanov in #1475
- Fix
Kysely<any>
type errors with narrow table name types by @koskimas in #1443 - fix
AsyncDisposable
usage erroring for older TypeScript versions. by @igalklebanov in #1507 - fix(helpers): JSON helpers' return types incorrectly have
Date
s and other JS/Node-native instances that require data type metadata. by @igalklebanov in #1477
MySQL π¬ / MS SQL Server π₯
- fix: bigint immediates are appended as string literals instead of numbers. by @igalklebanov in #1445
MS SQL Server π₯
- fix(mssql): socket error handling during connect. by @igalklebanov in #1463
π Documentation
- Update plugins.md: fix broken link by @catnipan in #1460
- Added Cloudflare Durable Objects dialect by @benallfree in #1476
- Add Firebird DB dialect by @benkoppe in #1479
π¦ CICD & Tooling
- ensure jsdocs check's dts is source of truth for docs examples. by @igalklebanov in #1436
- chore: bye bye node 18. by @igalklebanov in #1450
- chore: bump deps, dump tsx for Node.js native TS. by @igalklebanov in #1451
- chore(CI): replace Node.js v23 with v24. by @igalklebanov in 1ae8829
- chore: make npm publishable package contents configuration safer/more maintainable. by @igalklebanov in #1456
- chore(CI): add native typescript type checks. by @igalklebanov in #1467
- Delete .renovaterc.json by @igalklebanov in 7d1c4e5
- chore: move pkg-pr-new to workflow only. by @igalklebanov in #1471
β οΈ Breaking Changes
π€ New Contributors
- @yawhide made their first contribution in #1459
- @catnipan made their first contribution in #1460
- @benallfree made their first contribution in #1476
- @benkoppe made their first contribution in #1479
Full Changelog: 0.28.2...v0.28.3
0.28.2
Hey π
v0.28 broke an undocumented TypeScript behavior our API had that allowed you to pass table name unions to query builders and enable some DRYing of queries. Seeing that this pattern was quite popular, we decided to support it officially with the addition of the table
method in the dynamic module.
You can pull off some crazy complex stuff like:
async function getRowByColumn<
T extends keyof Database,
C extends keyof Database[T] & string,
V extends SelectType<Database[T][C]>,
>(t: T, c: C, v: V) {
// We need to use the dynamic module since the table name
// is not known at compile time.
const { table, ref } = db.dynamic
return await db
.selectFrom(table(t).as('t'))
.selectAll()
.where(ref(c), '=', v)
// `id` can be directly referenced since every table has it.
.orderBy('t.id')
.executeTakeFirstOrThrow()
}
const person = await getRowByColumn('person', 'first_name', 'Arnold')
...and it'll narrow the downstream query context to the intersection of all the possible shapes of tables in the union type. (DONT DO THIS AT HOME KIDS!)
A simpler example would be:
async function deleteItem(id: string, table: 'person' | 'pet') {
await db
.deleteFrom(db.dynamic.table(table).as('t'))
.where('id', '=', id)
.executeTakeFirstOrThrow()
}
If you attempt to refer to a column that doesn't exist in both "person" and "pet" (e.g. "pet"'s "species" column), the compiler will correctly yell at you.
π Features
π Bugfixes
SQLite π
- fix: SQLite's introspector is printing deprecation errors for
orderBy(array)
. by @igalklebanov in #1435
π Documentation
π¦ CICD & Tooling
β οΈ Breaking Changes
π€ New Contributors
Full Changelog: 0.28.1...0.28.2
0.28.1
Hey π
Just a small crucial bug fix release. Please inform us if you see any more regressions since v0.28. π
π Features
π Bugfixes
PostgreSQL π
π Documentation
π¦ CICD & Tooling
β οΈ Breaking Changes
π€ New Contributors
Full Changelog: 0.28.0...0.28.1
0.28.0
Hey π
Transactions are getting a lot of love in this one!
As part an effort to replace Knex with Kysely, B4nan, the author of mikro-orm drove the new setAccessMode('read only'|'read write')
method when starting transactions.
You can now commit/rollback transactions manually and there's even savepoint support:
const trx = await db.startTransaction().execute()
try {
// do stuff with `trx`, including work with savepoints via the new `savepoint(name)`, `rollbackToSavepoint(name)` and `releaseSavepoint(name)` methods!
await trx.commit().execute()
} catch (error) {
await trx.rollback().execute()
throw error
}
We also added using
keyword support, so now you can write:
await using db = new Kysely({...})
and db.destroy()
will be called automatically once the current scope is exited.
If you plan on trying this out (it is optional, you can still const db = new Kysely({...})
and await db.destroy()
manually), the using
keyword requires typescript >= 5.2
and the following tsconfig.json
options:
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ESNext", ...],
...
}
...
}
We also added a plugin to handle in ()
and not in ()
. It comes with 2 handling strategies, one similar to how Knex.js, PrismaORM, Laravel and SQLAlchemy do it, and one similar to how TypeORM and Sequelize do it. It also supports custom strategies, e.g. throwing an error to avoid making a call to the database and wasting resources. Here's an example with one of the strategies we ship:
import {
// ...
HandleEmptyInListsPlugin,
// ...
replaceWithNoncontingentExpression,
// ...
} from 'kysely'
const db = new Kysely<Database>({
// ...
plugins: [
new HandleEmptyInListsPlugin({
strategy: replaceWithNoncontingentExpression
})
],
})
// ...
.where('id', 'in', [])
.where('first_name', 'not in', []) // => `where 1 = 0 and 1 = 1`
π Features
InferResult
should output plural. by @igalklebanov in #1064- Speedup types with huge databases. Fixes #867 by @koskimas in #1080
- implement missing expression features by @koskimas in #1085
- Remove preventAwait by @wirekang in #1160
- add
ControlledTransaction
. by @igalklebanov in #962 & #1193 await using kysely = new Kysely()
support. by @igalklebanov in #1167- feat: add HandleEmtpyInListsPlugin. by @austinwoon and @igalklebanov in #925
- Add Date as a valid return type for max and min by @samclearman & @igalklebanov in #1062
- Add support for cross join and cross join lateral by @ersinakinci in #1325
- dry up joins. by @igalklebanov in c95f499
- revisiting orderBy - deprecations, new order by item builder (nullFirst(), nullsLast(), collate()). by @igalklebanov in #1326
- add
queryId
toCompiledQuery
and all transformer methods. by @igalklebanov in #176 - feat: Add disableTransactions option to Migrator by @reidswan in #1335
- Redundant export UpdateValuesNode removed by @Ciantic in #1379
- Fix ctrl transaction mutation issues by @koskimas in #1406
- feat: escape single quotes in string literals. by @igalklebanov in #1392
PostgreSQL π / MySQL π¬
PostgreSQL π / MS SQL Server π₯
PostgreSQL π / SQLite π
PostgreSQL π
- feat: support refresh materialized view by @QuentinJanuel in #990
- add
returning
support inMERGE
queries. by @igalklebanov in #1171 - Support json_agg(column_ref) by @SimonSimCity in #1316
- feat: expands limit in select accepting null value by @alenap93 in #1347
- feat: make create type as enum values argument readonly. by @igalklebanov in #1390
- add support for constraint renaming. by @koskimas in #1408
MySQL π¬
MS SQL Server π₯
- Add outer and cross apply (mssql) by @drew-marsh in #1074
- refactor: extract
validateConnections
andresetConnectionsOnRelease
to root of config, flip defaultresetConnectionsOnRelease
behavior. by @igalklebanov in #1388
SQLite π
- SQLite's OR CONFLICT clause for inserts by @vincentiusvin & @igalklebanov in #976
π Bugfixes
- fix: no logging in streams. by @igalklebanov in #1382
- fix: ImmediateValueTransformer not handling PrimitiveValueListNodes. by @igalklebanov in #1396
- fix: allow empty array for sql.join by @Sealos in #1395
PostgreSQL π
- fix: postgres auto increment introspection is wrong after column renames. by @igalklebanov in #1391
π Documentation
- add reusable helpers recipe by @koskimas in #1085
- fix jsdocs. by @igalklebanov in 1c5e03a
π¦ CICD & Tooling
- ci: run 22.x by @igalklebanov in 9736aeb
- chore: enforce min TS version by @igalklebanov in #1194
- fix package-lock. by @igalklebanov in f348dfb
- add TypeScript benchmarks. by @igalklebanov in #1314
- improve join tests dialect coverage. by @igalklebanov in 6eaf754
- minor ci tweaks. by @igalklebanov in ca11632
β οΈ Breaking Changes
InferResult
now outputsInsertResult[]
,UpdateResult[]
,DeleteResult[]
,MergeResult[]
, instead ofInsertResult
,UpdateResult
,DeleteResult
,MergeResult
. To get the singular form, usetype Result = InferResult<T>[number]
.- Some generic/wide usages of
QueryCreator
's methods should no longer pass type checks. We never supported these officially. - As
preventAwait
is now removed on all builders, you must avoid awaiting builders without callingexecute
-like methods on your own. - TypeScript versions 4.5 and older are no longer supported. You will get an immediate compilation error telling you to upgrade.
QueryResult.numUpdatedOrDeletedRows
has been removed (after spending ~2 years in deprecation). We still log a warning. Outdated dialects that don't useQueryResult.numAffectedRows
should be updated OR forked.DefaultQueryExecutor.compileQuery
now requires passing aqueryId
argument. Use the newly exportedcreateQueryId()
as that argument value from now on.UpdateValuesNode
type has been removed.MssqlDialectConfig.tedious.resetConnectionOnRelease
has been deprecated, and had it's default flipped tofalse
. UseMssqlDialectConfig.resetConnectionsOnRelease
instead.MssqlDialectConfig.tarn.options.validateConnections
has been deprecated. UseMssqlDialectConfig.validateConnections
instead.- String literals are now
'
injection protected, hopefully. Please report any issues.
π€ New Contributors
- @QuentinJanuel made their first contribution in #990
- @austinwoon made their first contribution in #925
- @samclearman made their first contribution in #1062
- @drew-marsh made their first contribution in #1074
- @SimonSimCity made their first contribution in #1316
- @ersinakinci made their first contribution in #1325
- @reidswan made their first contribution in #1335
- @B4nan made their first contribution in #1342
- @Ciantic made their first contribution in #1379
- @Sealos made their first contribution in #1395
Full Changelog: 0.27.6...0.28.0
0.27.6
Hey π
v0.28 is right around the corner! π
π Features
π Bugfixes
- fix: implements a underscore validation to camelcase plugin by @rhyzzor in #1290
- fix: resolve edge case with varying shapes in multiple item inserts causing undefined in parameters. by @naorpeled & @igalklebanov in #1311
PostgreSQL π
- Use JS sort method to sort migrations by name by @DavesBorges in #844
- fix: WithSchemaPlugin is adding schema to table function arguments and causes db errors in json_agg and to_json. by @igalklebanov in #827
SQLite π
- fix: isAutoIncrementing: true for sqlite integer primary key by @tgriesser in #1344 and #1349
π Documentation
- Update CONTRIBUTING.md by @igalklebanov in bfbd002
- badge stuff @ README.md by @igalklebanov in 541c935
- add CODE_OF_CONDUCT.md by @igalklebanov in #564
- add another example to CoC. by @igalklebanov in 9ba0f02
- explain examples in CoC. by @igalklebanov in 708afad
- add example to CoC. by @igalklebanov in 1ba5586
- add examples to CoC. by @igalklebanov in 1cbe9b5
- CoC wording. by @igalklebanov in 5598338
- add reactions as an example in CoC. by @igalklebanov in 67e413e
- Add a reference to ref in table's docstring by @AlexErrant in #1315
- add FUNDING.md by @igalklebanov in #1317
- Update _prerequisites.mdx by @igalklebanov in bd167d3
- fix minor typo in raw-builder/sql by @austin-tildei in #1346
- fix(docs): Fixed closing backtick in Migrator JSDoc by @nick-w-nick in #1348
- remove X links. by @igalklebanov in 4870549 and deedd28
- add Marvin's (Deno) quote. by @igalklebanov in #1360
- Add Oracle dialect to dialects.md by @JosephTuffin in #1371
PostgreSQL π
π¦ CICD & Tooling
β οΈ Breaking Changes
π€ New Contributors
- @rhyzzor made their first contribution in #1290
- @AlexErrant made their first contribution in #1315
- @czeidler made their first contribution in #1319
- @austin-tildei made their first contribution in #1346
- @JosephTuffin made their first contribution in #1371
Full Changelog: 0.27.5...0.27.6