v0.30.0-beta.0Pre-release
0.30.0-beta.0
Added 4
- Add transactionMode property to Migrator supporting 'per-run', 'per-migration', and 'none' modes
- Add defineMigration helper function for writing migrations with explicit contract requirements
- Enable per-migration transaction configuration via config.transaction property
- Add compile-time errors when passing BLOB columns to SQLite JSON helpers
Changed 1
- SQLite JSON helpers now enforce compile-time type checking to prevent BLOB value usage
Deprecated 1
- Deprecate disableTransactions in favor of transactionMode
Hey 👋
0.30 season is upon us. pnpm i kysely@next and get a sneak peak into the future!
We've got a new transactionMode: 'per-run' | 'per-migration' | 'none' property you can pass to Migrator or it's methods.
'per-run'is the classic behavior you're used to wherekyselywrap the entire run in a transaction when your dialect supports transactional DDL.'per-migration'enables each migration to pick whether it runs in its own transaction or not. Just exposeconfig: { transaction: false }from the module, right next to theup/downfunctions.'none'means no transactions are used, which is similar to the now deprecateddisableTransactions: true.
import * as fs from 'node:fs/promises'
import * as path from 'node:path'
import { FileMigrationProvider, Migrator } from 'kysely/migration'
const migrator = new Migrator({
db,
provider: new FileMigrationProvider({
fs,
migrationFolder: path.join(import.meta.dirname, 'migrations'),
}),
transactionMode: 'per-migration', // <-------------------------------
})
await migrator.migrateToLatest()
We've got a new defineMigration helper function that you can use to easily write your migrations and meet the contract requirements:
import { defineMigration } from 'kysely/migration'
export default defineMigration({
up: async (db) => {
// ...
},
config: { transaction: false }, // <--------------------
})
🚀 Features
PostgreSQL 🐘 / MSSQL 🥅
- feat: Per-migration transaction configuration by @lourd & @igalklebanov in https://github.com/kysely-org/kysely/pull/1671
SQLite 📘
- feat: deny passing BLOB-like columns to SQLite JSON helpers by @hwisu & @igalklebanov in https://github.com/kysely-org/kysely/pull/1698
🐞 Bugfixes
📖 Documentation
📦 CICD & Tooling
⚠️ Breaking Changes
disableTransactionsis deprecated. Use the newtransactionMode: 'none', ortransactionMode: 'per-migration'with combination ofconfig: { transaction: false }.
SQLite 📘
- Trying to pass records with
BLOBcolumns in JSON helpers emits compile-time errors - e.g.KyselyTypeError<'SQLite does not support passing `BLOB` values to `json_object`. Cast to `TEXT`.'>
🐤 New Contributors
- @lourd made their first contribution in https://github.com/kysely-org/kysely/pull/1671
What's Changed
Full Changelog: https://github.com/kysely-org/kysely/compare/4ba0bd495a4cbe11d8d58ef02537586dc4d56532...v0.30.0-beta.0