node-pg-migrate icon indicating copy to clipboard operation
node-pg-migrate copied to clipboard

Node-pg-migrate not working when I upgrade Node from 12 - 16

Open jeevanthomas opened this issue 2 years ago • 7 comments

Hi, I have been working on a project using Node 12.20.1 . When I tried upgrading to the latest version of Node I realized that

> node-pg-migrate "up" command is not working. I am not getting any errors thrown at my terminal, but the existing migration scripts are not running. Can someone please check

I am using 3.18.1 version of node-pg-migrate, I tried upgrading it to 6.2.1 , but that doesn't seem to help. Is there something else I need to do ?

jeevanthomas avatar Mar 25 '22 12:03 jeevanthomas

Do you have a migration example to test with?

My setup works:

$ node -v
v16.14.2

$ npx node-pg-migrate --version
6.2.1

# Postgres
# show server_version;
 server_version 
----------------
 14.2
(1 row)

Ensure you're running the local version of node-pg-migrate and not a global version.

mike-usa avatar Apr 30 '22 03:04 mike-usa

I have this problem as well. node-pg-migrate up command does not return any message nor does it execute migrations. Node versions 12 and 13 seem to work OK.

Affected versions (at least):

  • Ubuntu 20.04 LTS
  • node-versions 13,14,16,18
  • node-pg-migrate 5.6.0, 6.2.1

Klyyssi avatar May 23 '22 14:05 Klyyssi

I am seeing the same issue.

  • node v 16.18.1
  • node-pg-admin v6.2.2
  • postgres v11.16

Could this be due to the postgres version?

mbaquerizo avatar Jan 27 '23 21:01 mbaquerizo

We also have this problem; Migrations ran successfully with node version 12.22.12, after upgrading to node 16 the node-pg-migrate up does not fail but does not seem to do anything.

  • node v 16.19.0
  • node-pg-migrate v6.2.2
  • postgres:9.6.3-alpine

Taschee avatar Feb 08 '23 14:02 Taschee

Found the solution (at least for me): After updating node (and node-pg-admin to 6.2.2), node-pg-migrate still had "pg" version 7.18.2 as transitive dependency. After installing "pg" version 8.9.0 manually, everything works again.

Root cause seemed to lie somewhere in the pg client connecting to pg;

I managed to reproduce the error in a minimal example (with postgres:9.6.3-alpine image as well):

package.json:

{ "name": "test-node-pg-migrate", "version": "1.0.0", "dependencies": { "node-pg-migrate": "6.2.2", "pg": "7.18.2" }, "scripts": { "migrate-up": "node-pg-migrate -f ./pg-migrate-dev.json up", "migrate-down": "node-pg-migrate -f ./pg-migrate-dev.json down" } }

So when using node 16, node-pg-migrate does not seem to work with pg version 7.18.2 (and probably other versions of pg as well). I guess having pg >= 8 as dependency would make sense.

Taschee avatar Feb 09 '23 21:02 Taschee

Found the solution (at least for me): After updating node (and node-pg-admin to 6.2.2), node-pg-admin still had "pg" version 7.18.2 as transitive dependency. After installing "pg" version 8.9.0 manually, everything works again.

Root cause seemed to lie somewhere in the pg client connecting to pg;

I managed to reproduce the error in a minimal example (with postgres:9.6.3-alpine image as well):

package.json:

{ "name": "test-node-pg-migrate", "version": "1.0.0", "dependencies": { "node-pg-migrate": "6.2.2", "pg": "7.18.2" }, "scripts": { "migrate-up": "node-pg-migrate -f ./pg-migrate-dev.json up", "migrate-down": "node-pg-migrate -f ./pg-migrate-dev.json down" } }

So when using node 16, node-pg-migrate does not seem to work with pg version 7.18.2 (and probably other versions of pg as well). I guess having pg >= 8 as dependency would make sense.

Just tested this and upgrading the pg package to 8.9.0 fixed the issue. Thanks!!

mbaquerizo avatar Feb 09 '23 21:02 mbaquerizo

Is this an still an issue? Or did https://github.com/salsita/node-pg-migrate/issues/887#issuecomment-1424851983 solved it completely? Is 7.0.0-alpha.0 maybe working better for you?

Shinigami92 avatar Mar 08 '24 22:03 Shinigami92