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

Support for AWS Redshift

Open andre-engelbrecht opened this issue 3 years ago • 7 comments

Does this package support AWS Redshift? Since Redshift is based on PostgreSQL, I'm hoping it'll just work? I've been trying it out but getting connection timeout issues, not sure if this is due to bad config on AWS or lack of support for Redshift?

andre-engelbrecht avatar Mar 29 '21 21:03 andre-engelbrecht

AFAIK this project uses pg under the hood

https://github.com/salsita/node-pg-migrate/blob/db3f9012374aa0917f408d12be91f5932ca336b1/package.json#L93

https://github.com/salsita/node-pg-migrate/blob/db3f9012374aa0917f408d12be91f5932ca336b1/src/db.ts#L32-L43

Shinigami92 avatar Mar 30 '21 06:03 Shinigami92

Yes, I know, that's why I'm thinking it should be compatible. I suspect there's simply something off in my AWS config, and I'll be working on that today, but I just wanted to make sure from the "source" that it should be compatible.

andre-engelbrecht avatar Mar 30 '21 14:03 andre-engelbrecht

I got the AWS config sorted out and was able to reach the Redshift DB, but I encountered to following error, which I assume means that this package isn't compatible with Redshift afterall.

Error executing:
CREATE TABLE "public"."pgmigrations" ( id SERIAL PRIMARY KEY, name varchar(255) NOT NULL, run_on timestamp NOT NULL)
error: Column "pgmigrations.id" has unsupported type "serial".

Error executing:
select pg_advisory_unlock(7241865325823964) as "lockReleased"
error: function pg_advisory_unlock(bigint) does not exist

function pg_advisory_unlock(bigint) does not exist
Error: Unable to ensure migrations table: error: Column "pgmigrations.id" has unsupported type "serial".

Feel free to close this issue if there's nothing more to say here!?

andre-engelbrecht avatar Mar 30 '21 17:03 andre-engelbrecht

@goce-cz Could you have a look into that and triage it? If there is nothing we can to support it, you should close the issue. Otherwise let's discuss and think about it.

Shinigami92 avatar Mar 30 '21 17:03 Shinigami92

hello, sorry for such a long time to answer.

yes we using serial for the table id in the migrations table... could we use smth else then unsupported types, for example, basic integer or smth. probably...

@andre-engelbrecht I believe, one way to overcome it, is to create the table for migrations manually prior and provide it's name to node-pg-migration (see https://salsita.github.io/node-pg-migrate/#/cli?id=configuration - migrationTable option) or use the default name pgmigrations.

node-pg-migrate will check if the table exists and have primary key constraint on id but that's about it.

littlewhywhat avatar May 31 '21 23:05 littlewhywhat

see also https://github.com/salsita/node-pg-migrate/pull/766, maybe you gonna get new errors

littlewhywhat avatar May 31 '21 23:05 littlewhywhat

I ended up just manually handling migrations for now. I bit of manually effort, but our Redshift DB is pretty static. Thanks for the feedback though.

andre-engelbrecht avatar Jun 01 '21 14:06 andre-engelbrecht