Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL + drizzle-orm #58

Open
1 task
kingyue737 opened this issue Mar 1, 2024 · 4 comments
Open
1 task

PostgreSQL + drizzle-orm #58

kingyue737 opened this issue Mar 1, 2024 · 4 comments

Comments

@kingyue737
Copy link

kingyue737 commented Mar 1, 2024

Describe the feature

It seems that only sqlite is supported when using drizzle integrator from db0.

BaseSQLiteDatabase,

Is there a plan to support other databases?

I also have some questions. Since the discussion tab is not enabled, I post them here by the way.

What's the recommended way to integrate drizzle in nuxt server routes? Like following?

// server/utils/db.ts
import { drizzle } from 'db0/integrations/drizzle/index'

export function useDb(name?: string) {
  return drizzle(useDatabase(name))
}

and then call useDb in every event handler?

I'm already using drizzle and pg in my nuxt project. What extra benefits does db0 bring? Moving config from a utils module to nuxt/nitro config? Seamless switching from one database to another as now we have a uniform config interface?

Thanks in advance

Additional information

  • Would you be willing to help implement this feature?
@amandesai01
Copy link
Contributor

For usage with Postgres, it is already supported. It may seem like it works only with SQLite, but I believe only dialects or something were used. I just wrote a passing test case for postgres to verify myself and it works like a charm.

b59e7db

@kingyue737
Copy link
Author

It seems that type is not correct.
Type PgColumn is not asignable to SQLiteColumn

@kingyue737
Copy link
Author

Sorry I forgot the reproduction:

https://stackblitz.com/edit/nuxt-starter-uxpj3c

@kingyue737
Copy link
Author

Tried v0.2.1, type still not correct

reproduction: https://stackblitz.com/edit/nuxt-starter-agnsks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants