drizzle-team / drizzle-team/drizzle-orm
[FEATURE] config dialect: export type
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
using
```
"drizzle-orm": "^0.30.10",
"drizzle-kit": "^0.21.4",
```
i'm trying to dynamically setup the config for drizzle-kit and this includes passing the dialect as string (e.g. 'postgresql')
sadly this wont work
```
dialect: db_conn.dialect // a string, croaks as it is not a drizzle-kit Dialect type
```
while the Dialect type is exportable from drizzle-orm this is not the same as drizzle-kit
(drizzle-orm uses 'pg' while drizzle-kit uses 'postgresql')
the dialect property is typed locally in drizzle-kit
```
declare const dialect: zod.ZodEnum<["postgresql", "mysql", "sqlite"]>;
type Dialect = TypeOf;
```
so this works fine:
```
import { defineConfig } from 'drizzle-kit';
import type { Dialect } from 'drizzle-kit';
export default defineConfig({
dialect: db_conn.dialect as Dialect,
[..]
```
there is a warning however as Dialect from drizzle-kit is only available locally
do you think you could export the Dialect then we can use it without warnings?
(btw, was it intentional for the Dialect types of drizzle-kit and drizzle-orm to differ?)
Contributor guide
Assessment
This issue has not been assessed yet.