fly proxy postgres data missing

Glad to hear it!

Don’t feel bad. This aspect of Postgres has been confusing people for decades…

Basically, there are “databases within the database”.

Officially, the latter is called a “database cluster”, but almost no one uses that terminology in everyday speech.

Anyway, your Postgres server has multiple, isolated sets of tables inside: these are the “databases” listed by the \l command. The remix_what2do_4555 database and the postgres database both contain tables named User in your case, but this is unusual.

The \c command was switching from one set of tables to the other.

\c postgres
select * from "User";

The above queried the User table in the postgres database.

\c remix_what2do_4555
select * from "User";

Whereas this one queried a completely different table—one that happens to also be named User—in the remix_what2do_4555 database.

This feature honestly is useful sometimes (e.g., to allow multiple apps to share a single Postgres machine without needing to rename their _prisma_migrations tables, etc.), although of course it caused confusion here.

I’d suggest SSHing into all of your remix-what2do-4555 instances to make sure that all of their DATABASE_URLs (or other equivalent connection configuration) do refer to the remix_what2do_4555 database and not to the other one:

$ fly m start     -a remix-what2do-4555     # start all
$ fly ssh console -a remix-what2do-4555 -s  # select each machine, in turn
# echo "$DATABASE_URL"  # not the only way of doing things, but the most common

The general form of the URL is…

postgres://user:password@host:port/database_name?options

I.e., every web-app machine should have /remix_what2do_4555 in the /database_name slot.

Likewise, when you connect manually with TablePlus or with psql (fly pg connect), then you will nearly always want to choose the remix_what2do_4555 database (in the \c sense). Otherwise, you end up looking at something completely different from what your web-app manipulates.

Hope this helps!