electric icon indicating copy to clipboard operation
electric copied to clipboard

Can't use `pgroll` for database migrations

Open davemaier opened this issue 2 years ago • 2 comments

Hi! I fell a bit in love with your project to be honest. Thanks for the great work so far.

Anyway. I'm trying to create a template to make project setup for my future projects easier. I wanted to use pgroll for database migrations and I'm a bit stuck there.

The problem is that pgroll doesn't seem to like the proxy. It applies the migrations if I use it directly on the database, but it gives me an error if I use it on the proxy.

The logs of the proxy also don't seem to be very helpful.

I first initialized pgroll using the pgroll init command directly on the database (gives the same error if used on the proxy)

Then I run the following command:

pgroll --postgres-url "postgresql://postgres:proxy_password@localhost:65432/postgres?sslmode=disable" start example.json

And I get this error

Error: driver: bad connection

Logs of the proxy service look like this:

offshore-stack-electric-1  | 08:57:12.122 pid=<0.3418.0> proxy_session_id=5 [warning] Not validating user "postgres"
offshore-stack-electric-1  | 08:57:12.122 pid=<0.3418.0> proxy_session_id=5 [info] Initialising injector in capture mode %Electric.Postgres.Proxy.Injector.Electric{}
offshore-stack-electric-1  | 08:57:12.127 pid=<0.3418.0> proxy_session_id=5 [info] Upstream connection is ready to accept queries

This repo can be used to reproduce: https://github.com/davemaier/offshore-template/tree/bug/pgroll-not-working

Thanks!

davemaier avatar Nov 19 '23 09:11 davemaier

@davemaier pgroll uses shadow columns(https://news.ycombinator.com/item?id=37753511) in a similar way to #668 special support would be needed to support that in the proxy.

gorbak25 avatar Nov 19 '23 14:11 gorbak25

Thanks for checking that. I'll be watching the other issue.

davemaier avatar Nov 20 '23 21:11 davemaier

👋 we've been working the last month on a rebuild of the Electric server over at a temporary repo https://github.com/electric-sql/electric-next/

You can read more about why we made the decision at https://next.electric-sql.com/about

We're really excited about all the new possibilities the new server brings and we hope you'll check it out soon and give us your feedback.

We're now moving the temporary repo back here. As part of that migration we're closing all the old issues and PRs. We really appreciate you taking the time to investigate and report this issue!

KyleAMathews avatar Aug 06 '24 13:08 KyleAMathews