A type-safe typescript SQL query builder
MIT License
Bot releases are hidden (Show)
Published by koskimas over 2 years ago
Published by koskimas over 2 years ago
Published by koskimas over 2 years ago
Published by koskimas over 2 years ago
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)
Published by koskimas over 2 years ago
orderBy
and limit
methods for DeleteQueryBuilder
Published by koskimas over 2 years ago
Published by koskimas over 2 years ago
Migrator
.Published by koskimas over 2 years ago
RawBuilder
constructor that can be easily used without a Kysely
instance.Published by koskimas over 2 years ago
Published by koskimas almost 3 years ago
Fix bug where RuntimeDriver was accidentally passed to dialect driver methods.
Published by koskimas almost 3 years ago
Remove mostly useless PrimitiveValue
type. This should improve compatibility with deno and browsers.
Published by koskimas almost 3 years ago
Use string literals in dynamic imports to make esbuild happy.
Published by koskimas almost 3 years ago
Make Buffer
optional. Required to make certain features work in browsers and deno.
Published by koskimas almost 3 years ago
Add couple of missing .js
extensions to imports.
Published by koskimas almost 3 years ago
The first two arguments of FileMigrationProvider have been removed.
Sorry for making this many breaking changes so fast. The API is finding its shape and things will calm down soon. I promise 😊
Published by koskimas almost 3 years ago
Add a forgotten exports to package.json file for the index-nodeless file.
Published by koskimas almost 3 years ago
Added an exprimental index-nodeless
entry point that doesn't export any node.js dependencies.
import {
CompiledQuery,
DatabaseConnection,
DatabaseIntrospector,
DatabaseMetadata,
DatabaseMetadataOptions,
DefaultQueryCompiler,
Dialect,
DialectAdapter,
Driver,
Kysely,
MIGRATION_LOCK_TABLE,
MIGRATION_TABLE,
QueryCompiler,
} from 'kysely/dist/cjs/index-nodeless.js'; // <-- The .js at the end is required
Optionally you can import the ESM version from kysely/dist/esm/index-nodeless.js
Published by koskimas almost 3 years ago
Fix a bug in returningAll
return type when using ColumnType
.
Published by koskimas almost 3 years ago
select
, insert
and update operations. See the example in the readme for more info.db.migrate
module has been removed. You now need to create an instance of Migrator instead.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'
})