4 months ago
I have initialized a new DB because I've been having problems with viewing the database within Railway dashboard and it seems like my backend is applying migrations, I am able to register via my front end, however, when I go to my Railway Postgres service to view the data, there are no tables. Does anyone know what could be going wrong ?
0 Replies
It also seems like there is now a 4th service (the one simply called Postgres) when I try to link from the CLI. I have never initialized this service myself.
Well those tables seem to be in schemas different from 'public', and the railway's data tab defaults to 'public'
So I connected to it with dbgate and it was showing me that it was empty. I then succeeded to connect to it from local CLI using the public url and pushed migrations from my local environment. However when I connect to sign up via the online frontend service and create an account, the account that I create doesn't appear in the service's DB. Which makes me think that the data is going somewhere else, perhaps that "Postgres" service that I see in the CLI but not in my project dashboard. I don't know why it would go there however as all my backend variables point to the r4EZ one …
Something else that I find off is that these migrations I see in the deploy logs of my backend service, I never prompt them anywhere, I don't have a pre deploy command or anything setup to apply migrations anywhere in my backend so idk where this even comes from.
4 months ago
few things -
> It also seems like there is now a 4th service (the one simply called Postgres)
Yep that is the database in the development environment.
> Something else that I find off is that these migrations I see in the deploy logs of my backend service, I never prompt them anywhere
You aren't, its the default though -
As for where the migrations are going, no clue, all I know is that you do not have the correct variables set, for example, you use DB_USER
in code, and have PGUSER
set on your service.
So I have fixed the variables, ended up getting name or service not found on backend service deployment, fixed that by changing backend runtime to V2 instead of legacy like I've seen in another thread. I then tried to create a new user in the initialized and EMPTY DB and it was telling me that this email is already in use, odd. I then deleted the DB made another one, (given that migrations should be applied by nixpacks) backend applies the migrations but the DB still doesn't have any tables.
TLDR: Correct variables being used yet still backend doesn't seem to push migrations to the postgres service
solutionISH: changed from using 5 database variables to using database URL. still unsure why it wasn't working, I checked many times
4 months ago
glad you found the problem
4 months ago
!s
Status changed to Solved brody • 4 months ago