drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
289 stars 17 forks source link

Migration uses `neon-serverless` even locally #576

Open Perdolique opened 2 weeks ago

Perdolique commented 2 weeks ago

I'm trying to run migration locally, but drizzle-kit migrate uses neon-serverless even if it's not defined anywhere. I have a local postgresql database with no web socket connections or neon-related stuff. Is it possible to use pg or so locally, but neon-serverless in production? Or define custom wsProxy in the local environment during migration?

sisou commented 3 days ago

In the changelog for drizzle-kit v0.21 it is specified in which order the drivers are searched for: https://github.com/drizzle-team/drizzle-kit-mirror/releases/tag/v0.21.0

So seems you just need to install pg package or postgres as a dev dependency and it should start using that automatically.

Perdolique commented 3 days ago

In case both are installed, neon-serverless will be ignored according to this hidden logic. So installing pg or postgres produces another set of problems because these packages have precedence over neon-serverless.

Perdolique commented 3 days ago

It would be nice to avoid somehow this opinionated order logic. By defining the specific driver/config for different cases, even locally.

In my case, I have Postgres installed in the Docker locally that I need to have access to directly and Neon database in the cloud that I need to have access to from my local machine also (but not limited by these two cases). So both drivers will be installed in this case, but drizzle-kit doesn't cover such cases at the moment.