Skip to content

Releases: kysely-org/kysely

0.19.0

11 May 04:36
Compare
Choose a tag to compare

What's new

Kysely now has absolutely no internal dependecies to anything. Not even dynamic ones. The same code runs on node, deno, browser and is compatible with all bundlers out of the box! All dependencies are passed from the outside.

Breaking changes

The dialects now take an instance of the underlying db drivers's pool (or other connection object if a pool is not available). This is how you'd create an instance of Kysely in 0.19.0:

import { Pool } from 'pg'

const db = new Kysely<Database>({
  dialect: new PostgresDialect({
    pool: new Pool({
      host: 'localhost',
      database: 'kysely_test'
    })
  })
})
import { createPool } from 'mysql2'

const db = new Kysely<Database>({
  dialect: new MysqlDialect({
    pool: createPool({
      host: 'localhost',
      database: 'kysely_test'
    })
  })
})
import Database from 'better-sqlite3'

const db = new Kysely<Database>({
  dialect: new SqliteDialect({
    database: new Database('db.sqlite')
  })
})

If you want to initialize the pool lazily when it's used for the first time, you can use a thunk:

import { Pool } from 'pg'

const db = new Kysely<Database>({
  dialect: new PostgresDialect({
    pool: async () => new Pool({
      host: 'localhost',
      database: 'kysely_test'
    })
  })
})

FileMigrationProvider

I also changed the FileMigrationProvider once again, even though I promised never to do that again 😞. This was done to get rid of all dependencies. You now need to use the class like this:

import { promises as fs } from 'fs'
import path from 'path'

new FileMigrationProvider({
  fs,
  path,
  migrationFolder: 'path/to/migrations/folder',
})

Deno and browser builds

There's no more need for the index-nodeless file and it has been removed. You can simply import kysely or the index.ts file from the dist folder. Nothing refers to node or any node library.

0.18.1

18 Apr 14:09
Compare
Choose a tag to compare
  • Allow custom migration tables and schema #80
  • Allow an existing pool instance to be passed to MysqlDialect and PostgresDialect #81

0.18.0

16 Apr 08:03
Compare
Choose a tag to compare

Breaking changes

UpdateQueryBuilder now takes four type arguments instead of three. The second argument is new and is the table that will be updated. The third one is a union of all the tables that can be referred to.

This only affects you if you've been using explicit types.

What's new

  • "update set from" queries are now possible because of the from method in UpdateQueryBuilder
  • Raw aliases are now possible when using the as method of a raw sql snippet.

0.17.3

10 Apr 09:49
Compare
Choose a tag to compare
  • Actually fix #73

0.17.2

10 Apr 09:43
Compare
Choose a tag to compare

0.17.1

17 Feb 16:02
Compare
Choose a tag to compare

0.17.0

17 Feb 11:22
Compare
Choose a tag to compare

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)

0.16.11

04 Feb 12:19
Compare
Choose a tag to compare
  • Added orderBy and limit methods for DeleteQueryBuilder

0.16.10

03 Feb 10:44
Compare
Choose a tag to compare

0.16.9

25 Jan 16:38
Compare
Choose a tag to compare