Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
136365c
fix: allow undefined values in Updateable type (#1496)
y-hsgw Jun 29, 2025
debddfc
feat(Introspect): add support for postgres & mysql foreign tables (#1…
williamluke4 Jun 29, 2025
a777837
feat: add PGlite dialect. (#1510)
igalklebanov Jul 20, 2025
feec74c
feat(migrator): allow disabling transactions in migrate methods. (#1517)
igalklebanov Jul 23, 2025
929d7b8
feat: allow expressions in unique constraint (#1518)
ericsodev Jul 26, 2025
db82875
update lockfile.
igalklebanov Jul 29, 2025
6aab324
chore: fix `next` branch rebase issues. (#1584)
igalklebanov Sep 20, 2025
9bb951e
feat: add `thenRef` method in `eb.case` (#1531)
ericsodev Sep 20, 2025
a915d84
Support dropping multiple types with schema.dropType(), cascade. (#1516)
aantia Sep 27, 2025
6b2e38c
implemented `whenRef(lhs, op, rhs)` in `eb.case`. (#1598)
iam-abdul Oct 2, 2025
feb520b
added `elseRef` in `eb.case()` (#1601)
iam-abdul Oct 4, 2025
294e0eb
feat: add `$pickTables`, `$omitTables` and `$extendTables`, deprecate…
igalklebanov Oct 4, 2025
a3780b2
fix tests after rebase.
igalklebanov Oct 9, 2025
0474919
feat: Add support for dropping temporary tables with temporary() modi…
szalonna Oct 11, 2025
8030771
fix unique-contraint-node following rebase.
igalklebanov Oct 12, 2025
4d71670
fix drop-type-node following rebase.
igalklebanov Oct 12, 2025
03015c2
fix slow types @ pglite-driver.
igalklebanov Oct 12, 2025
3fb00c1
feat: add `SafeNullComparisonPlugin` plugin (#1338)
rafaelalmeidatk Oct 12, 2025
c944930
feat: add addIndex to CreateTableBuilder (#1352)
alenap93 Oct 12, 2025
10f70a2
fix `next` branch following rebase.
igalklebanov Dec 13, 2025
1e50479
fix `next` branch following rebase.
igalklebanov Dec 14, 2025
9b04c83
feat: add more control through configuration @ ParseJSONResultsPlugin…
igalklebanov Dec 21, 2025
d668720
feat: allow expressions in create/add index's `column` and `columns` …
igalklebanov Dec 21, 2025
b1bd9cc
feat(Migrator): allow passing transactions to `Migrator`. (#1480)
jlucaso1 Dec 21, 2025
2ef37b3
fix `next` branch following rebase.
igalklebanov Dec 21, 2025
fc9207b
Per-migration transaction configuration
lourd Jan 3, 2026
1a9ef42
Let disabling options take precedence
lourd Jan 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ jobs:
run: pnpm script:exclude-test-files-for-backwards-compat

- name: Run tests with older TypeScript version
run: pnpm test:typings${{ env.TS_VERSION != '~4.6.0' && ' && pnpm test:node:build' || '' }}
run: pnpm test:typings${{ env.TS_VERSION != '~4.6.0' && env.TS_VERSION != '~4.7.0' && env.TS_VERSION != '~4.8.0' && ' && pnpm test:node:build' || '' }}

jsdocs:
name: JSDocs
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
[![Bluesky](https://img.shields.io/badge/Bluesky-0285FF?style=flat&logo=Bluesky&logoColor=white)](https://bsky.app/profile/kysely.dev)

###### Get started
[![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=flat&logo=postgresql&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=postgresql)
[![MySQL](https://img.shields.io/badge/mysql-4479A1.svg?style=flat&logo=mysql&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=mysql)
[![MicrosoftSQLServer](https://img.shields.io/badge/Microsoft%20SQL%20Server-CC2927?style=flat&logo=microsoft%20sql%20server&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=mssql)
[![SQLite](https://img.shields.io/badge/sqlite-%2307405e.svg?style=flat&logo=sqlite&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=sqlite)
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-%23316192.svg?style=flat&logo=postgresql&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=postgresql)
[![MySQL](https://img.shields.io/badge/MySQL-4479A1.svg?style=flat&logo=mysql&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=mysql)
[![MSSQL](https://img.shields.io/badge/MSSQL-CC2927?style=flat&logo=microsoft%20sql%20server&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=mssql)
[![SQLite](https://img.shields.io/badge/SQLite-%2307405e.svg?style=flat&logo=sqlite&logoColor=white)](https://kysely.dev/docs/getting-started?dialect=sqlite)
[![PGlite](https://img.shields.io/badge/PGlite-131517.svg?style=flat&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMTgxIiB2aWV3Qm94PSIwIDAgMzQwIDI3MiIgZmlsbD0ibm9uZSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMjg4IDg4LjA1MDdMMjg4IDIxNS45N0MyODggMjIwLjM5MSAyODQuNDEzIDIyMy45NzUgMjc5Ljk5MSAyMjMuOTdMMjQ3Ljk2OCAyMjMuOTMyQzI0My43MzQgMjIzLjkyNyAyNDAuMjcyIDIyMC42MzQgMjM5Ljk5NSAyMTYuNDcxQzIzOS45OTggMjE2LjMxMyAyNDAgMjE2LjE1NSAyNDAgMjE1Ljk5NkwyMzkuOTk5IDE2Ny45OThDMjM5Ljk5OSAxNTQuNzQ0IDIyOS4yMzkgMTQzLjk5OSAyMTUuOTg0IDE0My45OTlDMjAzLjEzOCAxNDMuOTk5IDE5Mi42MzYgMTMzLjkwNiAxOTIgMTIxLjIxN1Y0OC4wMDk1TDI0OC4wMyA0OC4wNTA3QzI3MC4xMDkgNDguMDY2OSAyODggNjUuOTcwOCAyODggODguMDUwN1pNMTI4IDQ3Ljk5ODNMMTI4IDEwNC4wMjNDMTI4IDExNy4yNzcg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xMDguMjE1QzI0Ni42NjcgMTA4LjIxNSAyNTIuMDQgMTAyLjg0MyAyNTIuMDQgOTYuMjE1M1oiIGZpbGw9IiNGNkY5NUMiLz48L3N2Zz4=)](https://kysely.dev/docs/getting-started?dialect=pglite)
& more!

# [Kysely](https://kysely.dev)
Expand Down
1 change: 1 addition & 0 deletions deno.check.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"types": ["./deno.check.d.ts"]
},
"imports": {
"@electric-sql/pglite": "npm:@electric-sql/pglite",
"better-sqlite3": "npm:better-sqlite3",
"kysely": "./dist/esm",
"kysely/helpers/mssql": "./dist/esm/helpers/mssql.js",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.2",
"@ark/attest": "^0.56.0",
"@electric-sql/pglite": "^0.3.14",
"@types/better-sqlite3": "^7.6.13",
"@types/chai": "^5.2.3",
"@types/chai-as-promised": "^8.0.2",
"@types/prototype-pollution-vulnerable-lodash.merge-dont-upgrade": "npm:@types/lodash.merge@4.6.1",
"@types/mocha": "^10.0.10",
"@types/node": "^24.10.1",
"@types/pg": "^8.16.0",
Expand All @@ -128,6 +130,7 @@
"mocha": "^11.7.5",
"mysql2": "^3.16.1",
"pathe": "^2.0.3",
"prototype-pollution-vulnerable-lodash.merge-dont-upgrade": "npm:lodash.merge@4.6.1",
"pg": "^8.17.1",
"pg-cursor": "^2.16.1",
"pkg-types": "^2.3.0",
Expand Down
31 changes: 31 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/docs/dialects.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A dialect is the glue between Kysely and the underlying database engine. Check t
| MySQL | https://kysely-org.github.io/kysely-apidoc/classes/MysqlDialect.html |
| Microsoft SQL Server (MSSQL) | https://kysely-org.github.io/kysely-apidoc/classes/MssqlDialect.html |
| SQLite | https://kysely-org.github.io/kysely-apidoc/classes/SqliteDialect.html |
| PGlite | https://kysely-org.github.io/kysely-apidoc/classes/PGliteDialect.html |

## Organization dialects

Expand Down
15 changes: 10 additions & 5 deletions site/docs/getting-started/Dialects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const builtInDialects: BuiltInDialect[] = [
driverDocsURL:
'https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md',
},
{
value: 'pglite',
driverDocsURL: 'https://pglite.dev/docs',
},
]

export function Dialects(props: DialectsProps) {
Expand All @@ -67,10 +71,10 @@ export function Dialects(props: DialectsProps) {
it. This requires a <code>Dialect</code> implementation.
<br />
<br />
There are 4 built-in dialects for PostgreSQL, MySQL, Microsoft SQL
Server (MSSQL), and SQLite. Additionally, the community has implemented
several dialects to choose from. Find out more at{' '}
<Link to="/docs/dialects">"Dialects"</Link>.
There are {builtInDialects.length} built-in dialects for PostgreSQL,
MySQL, Microsoft SQL Server (MSSQL), SQLite, and PGlite. Additionally,
the community has implemented several dialects to choose from. Find out
more at <Link to="/docs/dialects">"Dialects"</Link>.
</p>
<Heading as="h3">Driver installation</Heading>
<p>
Expand All @@ -82,7 +86,8 @@ export function Dialects(props: DialectsProps) {
<Tabs queryString="dialect">
{builtInDialects.map(({ driverDocsURL, poolDocsURL, value }) => {
const driverNPMPackage = getDriverNPMPackageNames()[value]
const poolNPMPackage = POOL_NPM_PACKAGE_NAMES[value]
const poolNPMPackage =
POOL_NPM_PACKAGE_NAMES[value as keyof typeof POOL_NPM_PACKAGE_NAMES]
const prettyDialectName = PRETTY_DIALECT_NAMES[value]
const installationCommand =
packageManager === 'deno'
Expand Down
11 changes: 11 additions & 0 deletions site/docs/getting-started/Instantiation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,16 @@ const dialect = new ${dialectClassName}({
})`
}

if (dialect === 'pglite') {
const driverImportName = 'PGlite'

return `import { ${driverImportName} } from '${driverNPMPackageName}'
import { Kysely, ${dialectClassName} } from 'kysely'

const dialect = new ${dialectClassName}({
pglite: new ${driverImportName}(),
})`
}

throw new Error(`Unsupported dialect: ${dialect}`)
}
3 changes: 2 additions & 1 deletion site/docs/getting-started/Querying.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export async function deletePerson(id: number) {

return person
}`,
// TODO: Update to use output clause once #687 is completed
mssql: `// As of v0.27.0, Kysely doesn't support the \`OUTPUT\` clause. This will change
// in the future. For now, the following implementations achieve the same results
// as other dialects' examples, but with extra steps.
Expand Down Expand Up @@ -69,7 +70,7 @@ export async function deletePerson(id: number) {
return person
}`,
sqlite: postgresqlCodeSnippet,
// TODO: Update to use output clause once #687 is completed
pglite: postgresqlCodeSnippet,
}

export function Querying(props: PropsWithDialect) {
Expand Down
18 changes: 12 additions & 6 deletions site/docs/getting-started/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ import {
type PropsWithDialect,
} from './shared'

const dialectSpecificCodeSnippets: Record<Dialect, string> = {
postgresql: ` await db.schema.createTable('person')
const postgresqlCodeSnippet = ` await db.schema.createTable('person')
.addColumn('id', 'serial', (cb) => cb.primaryKey())
.addColumn('first_name', 'varchar', (cb) => cb.notNull())
.addColumn('last_name', 'varchar')
.addColumn('gender', 'varchar(50)', (cb) => cb.notNull())
.addColumn('created_at', 'timestamp', (cb) =>
cb.notNull().defaultTo(sql\`now()\`)
)
.execute()`,
.execute()`

const dialectSpecificCodeSnippets: Record<Dialect, string> = {
postgresql: postgresqlCodeSnippet,
mysql: ` await db.schema.createTable('person')
.addColumn('id', 'integer', (cb) => cb.primaryKey().autoIncrement())
.addColumn('first_name', 'varchar(255)', (cb) => cb.notNull())
Expand Down Expand Up @@ -48,13 +50,17 @@ const dialectSpecificCodeSnippets: Record<Dialect, string> = {
cb.notNull().defaultTo(sql\`current_timestamp\`)
)
.execute()`,
pglite: postgresqlCodeSnippet,
}

const truncateTableSnippet = `await sql\`truncate table \${sql.table('person')}\`.execute(db)`

const dialectSpecificTruncateSnippets: Record<Dialect, string> = {
postgresql: `await sql\`truncate table \${sql.table('person')}\`.execute(db)`,
mysql: `await sql\`truncate table \${sql.table('person')}\`.execute(db)`,
mssql: `await sql\`truncate table \${sql.table('person')}\`.execute(db)`,
postgresql: truncateTableSnippet,
mysql: truncateTableSnippet,
mssql: truncateTableSnippet,
sqlite: `await sql\`delete from \${sql.table('person')}\`.execute(db)`,
pglite: truncateTableSnippet,
}

export function Summary(props: PropsWithDialect) {
Expand Down
15 changes: 12 additions & 3 deletions site/docs/getting-started/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { useLocation } from '@docusaurus/router'
import { useEffect, useState, type ReactNode } from 'react'
import packageJson from '../../package.json'

export const DIALECTS = ['postgresql', 'mysql', 'sqlite', 'mssql'] as const
export const DIALECTS = [
'postgresql',
'mysql',
'sqlite',
'mssql',
'pglite',
] as const

export type Dialect = (typeof DIALECTS)[number]

Expand Down Expand Up @@ -47,6 +53,7 @@ export const DIALECT_CLASS_NAMES = {
mysql: 'MysqlDialect',
mssql: 'MssqlDialect',
sqlite: 'SqliteDialect',
pglite: 'PGliteDialect',
} as const satisfies Record<Dialect, string>

export const getDriverNPMPackageNames = (
Expand All @@ -57,6 +64,7 @@ export const getDriverNPMPackageNames = (
mysql: 'mysql2',
mssql: 'tedious',
sqlite: 'better-sqlite3',
pglite: '@electric-sql/pglite',
}) as const satisfies Record<Dialect, string>

export const POOL_NPM_PACKAGE_NAMES = {
Expand All @@ -68,6 +76,7 @@ export const PRETTY_DIALECT_NAMES = {
mysql: 'MySQL',
mssql: 'Microsoft SQL Server (MSSQL)',
sqlite: 'SQLite',
pglite: 'PGlite',
} as const satisfies Record<Dialect, string>

export const PRETTY_PACKAGE_MANAGER_NAMES = {
Expand Down Expand Up @@ -114,7 +123,7 @@ export function getBashCommand(
}

export function getDenoCommand(
additionalImports?: Record<string, string>,
additionalImports?: Record<string, string | undefined>,
): Command {
return {
content: JSON.stringify(
Expand Down Expand Up @@ -142,7 +151,7 @@ export function getDenoCommand(
}

export interface UseSearchStateProps<Value extends string> {
defaultValue?: Value
defaultValue: Value
searchParam?: string
validator?: (searchValue: string | null) => boolean
value?: Value
Expand Down
4 changes: 4 additions & 0 deletions site/docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ A plugin that removes duplicate joins from queries. You can read more about it i
### Handle `in ()` and `not in ()` plugin

A plugin that allows handling `in ()` and `not in ()` with a chosen strategy. [Learn more](https://kysely-org.github.io/kysely-apidoc/classes/HandleEmptyInListsPlugin.html).

### Safe null comparison plugin

A plugin that converts `=`, `!=` and `<>` to the equivalent `is` and `is not` operators when the right-hand side value is `null`. [Learn more](https://kysely-org.github.io/kysely-apidoc/classes/SafeNullComparisonPlugin.html).
4 changes: 2 additions & 2 deletions site/src/components/SectionFeatures/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const FeatureList: FeatureItem[] = [
<>
Kysely's community-driven dialect system makes it easy to implement
support for any SQL database without waiting for the core team. It ships
with official dialects for PostgreSQL, MySQL, MS SQL Server, and SQLite
right out of the box.
with official dialects for PostgreSQL, MySQL, MS SQL Server, SQLite, and
PGlite right out of the box.
</>
),
},
Expand Down
1 change: 1 addition & 0 deletions src/dialect/database-introspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface DatabaseMetadata {
export interface TableMetadata {
readonly name: string
readonly isView: boolean
readonly isForeign: boolean
readonly columns: ColumnMetadata[]
readonly schema?: string
}
Expand Down
4 changes: 4 additions & 0 deletions src/dialect/dialect-adapter-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export abstract class DialectAdapterBase implements DialectAdapter {
return true
}

get supportsMultipleConnections(): boolean {
return true
}

get supportsTransactionalDdl(): boolean {
return false
}
Expand Down
Loading
Loading