Releases: kysely-org/kysely
Releases Β· kysely-org/kysely
0.15.1
0.15.0
- New ColumnType and Generated interfaces for defining separate interfaces for
select
,insert
and update operations. See the example in the readme for more info.
Breaking changes
- The
db.migrate
module has been removed. You now need to create an instance of Migrator instead. - The new
Generated
interface removes the need fordb.generated
which has now been removed. Simply mark your db-generated columns withGenerated<T>
in the table interface and removedb.generated
.
Before:
interface Person {
id: number,
first_name: string
}
await db.insertInto('person').values({
id: db.generated,
first_name: 'Jennifer'
})
Now:
interface PersonTable {
id: Generated<number>,
first_name: string
}
type Person = Selectable<PersonTable>
await db.insertInto('person').values({
first_name: 'Jennifer'
})
0.14.1
0.14.0
- Kysely now supports all the features of SQLite on conflict clause (almost all features of the PostgreSQL on conflict clause)
Breaking changes
- All
expression
methods in the schema module previously took a raw SQL string. Those all now take adb.raw
instance instead for consistency.
// Before
db.schema
.alterTable('person')
.addCheckConstraint('some_constraint', 'a < b')
// Now
db.schema
.alterTable('person')
.addCheckConstraint('some_constraint', db.raw('a < b'))
onConflictDoNothing
andonConflictUpdate
methods have been replaced by a single onConflict method.
// Before
db.insertInto('pet').values(pet).onConflictUpdate('name', updates)
// Now
db.insertInto('pet').values(pet).onConflict(
// Also see the `columns` and `constraint` methods.
(oc) => oc.column('name').doUpdateSet(updates)
)
// Before
db.insertInto('pet').values(pet).onConflictDoNothing('name')
// Now
db.insertInto('pet').values(pet).onConflict(
(oc) => oc.column('name').doNothing()
)
0.13.0
- Added migrateTo, migrateUp and migrateDown methods.
- Added unsigned method for creating unsigned integer columns on MySQL.
Breaking changes
- migrateToLatest no longer throws. The error is returned instead. See the return value type documentation for more info.
0.12.2
- Added withRecursive for recursive common table expressions.
- Support node 14. Kysely will support the last two LTS versions from now on.
0.12.1
0.12.0
- Added support for temporary tables
- Added support for insert into select from queries
Breaking changes
- Renamed the
subQuery
method to selectFrom. - Created separate query builders for select, insert, update and delete queries. This is only a breaking change if you have used the
QueryBuilder
type explicitly.
0.11.4
Support callback subqueries and raw expressions in insert queries:
db.with('jennifer', (db) => db
.selectFrom('person')
.where('first_name', '=', 'Jennifer')
.select(['id', 'first_name'])
.limit(1)
).insertInto('pet').values({
id: db.generated,
owner_id: (eb) => eb.subQuery('jennifer').select('id'),
name: (eb) => eb.subQuery('jennifer').select('first_name'),
species: 'cat',
})