migrate with node-postgres
I had migration working well with postgresjs but need to switch to node-postgres for other reasons. But I can't get migration to work and it just hangs. The code I have is:
Also how/where do you set max with pg? TIA.
7 Replies
I’d recommend using the CLI instead, because it doesn’t rely on any PostgreSQL client, apparently.
Add your database URI to the config file under the dbCredentials field as a connection string:
And nowj you can ust run:
Now, you can do migrations without any concern about the actual client.
P.S.: I’m a newbie in Drizzle too and I’m just “trying to help” you. I would welcome it if you correct me if I’m wrong.
Thanks. That is a better way in general. Unfortunately, it still just hangs for me.
can you share the error message?
change
client
to pool
solves issue
real issue is with not using await client.connect();
and await pg.end();
Had the exact same issue... the woraround to use the
Pool({max: 1})
worked for me!
The push
command is very nice but it is not enough if you need to modify the generated migration SQL files (for instance to add data migrations)try this if you still want to use client instead of pool