1
0
mirror of https://github.com/theoludwig/kysely-typegen.git synced 2026-05-22 16:23:25 +02:00
Commit Graph

3 Commits

Author SHA1 Message Date
theoludwig e11a4d2722 feat: add MySQL support
Adds `KyselyTypegenMySQLDialect`, exported from `kysely-typegen/mysql`.
2026-05-22 16:01:01 +02:00
theoludwig e9adb364e0 refactor!: move KyselyTypegenPostgresDialect export to /postgres
To prepare for additional dialects and keep the default entry tiny,
`KyselyTypegenPostgresDialect` is now exported from a dedicated
`kysely-typegen/postgres` subpath instead of the package root.

The `KyselyTypegenDialect` base class is also reworked to support
dialects where enums are declared per-column rather
than as a named top-level type. The abstract `getEnumsMap()` method
is replaced by an optional `introspectEnums()` hook returning both
`named` and `inline` enums.

BREAKING CHANGE: `KyselyTypegenPostgresDialect` is no longer exported
from `kysely-typegen`. Import it from `kysely-typegen/postgres`.

Before:

```ts
import { KyselyTypegenPostgresDialect } from "kysely-typegen"
```

After:

```ts
import { KyselyTypegenPostgresDialect } from "kysely-typegen/postgres"
```

BREAKING CHANGE: custom dialects extending `KyselyTypegenDialect`
must replace `protected getEnumsMap()` with `protected introspectEnums()`,
which returns `{ named, inline }` instead of a flat `Map<string, string[]>`.

Before:

```ts
protected async getEnumsMap(): Promise<Map<string, string[]>> {
  return new Map([["Role", ["admin", "member"]]])
}
```

After:

```ts
protected override async introspectEnums(): Promise<IntrospectedEnums> {
  return {
    named: [{ name: "Role", values: ["admin", "member"] }],
    inline: new Map(),
  }
}
```
2026-05-22 15:59:38 +02:00
theoludwig d9839d01c7 chore: initial commit 2026-05-20 20:40:14 +02:00