Skip to content

Releases: kysely-org/kysely

0.15.1

05 Jan 11:34
Compare
Choose a tag to compare

Fix a bug in returningAll return type when using ColumnType.

0.15.0

05 Jan 04:48
Compare
Choose a tag to compare
  • 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 for db.generated which has now been removed. Simply mark your db-generated columns with Generated<T> in the table interface and remove db.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

30 Dec 17:23
Compare
Choose a tag to compare

Removed a magical UnionToIntersection type that made it difficult to write generic helpers.

0.14.0

30 Dec 09:35
Compare
Choose a tag to compare

Breaking changes

  • All expression methods in the schema module previously took a raw SQL string. Those all now take a db.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 and onConflictUpdate 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

28 Dec 12:07
Compare
Choose a tag to compare

Breaking changes

0.12.2

21 Dec 13:08
Compare
Choose a tag to compare
  • Added withRecursive for recursive common table expressions.
  • Support node 14. Kysely will support the last two LTS versions from now on.

0.12.1

16 Dec 11:46
Compare
Choose a tag to compare

Make jsdoc comments better accessible by copying them from the interfaces to the implementing classes. This is done automatically as a build step.

0.12.0

16 Dec 05:12
Compare
Choose a tag to compare

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

11 Dec 16:04
Compare
Choose a tag to compare

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',
})

0.11.3

11 Dec 13:17
Compare
Choose a tag to compare

Support custom log function:

const db = new Kysely<Database>({
  dialect: new PostgresDialect(postgresConfig),
  log(event) {
    if (event.level === 'query') {
      console.log(event.query.sql)
      console.log(event.query.parameters)
    }
  }
})