Skip to content

0.17.0

Compare
Choose a tag to compare
@koskimas koskimas released this 17 Feb 11:22
· 762 commits to master since this release

Breaking changes

db.raw has been replaced with the sql template tag. sql is a free function that can be used with or without a Kysely instance.

See the docs for detailed instructions. Here's how you'd replace the most common use cases of the old db.raw:

import { sql } from 'kysely'

// old
db.raw('select first_name from person where id = ?', [id])

// new
sql`select first_name from person where id = ${id}`
import { sql } from 'kysely'

// old
db.raw('select ?? from person', ['first_name'])

// new
sql`select ${sql.ref('first_name')} from person`
import { sql } from 'kysely'

// old
const result = await db.raw('select first_name from person where id = ?', [id]).execute()

// new
const result = await sql`select first_name from person where id = ${id}`.execute(db)