2 months ago
I updated my app.
everytime you add a new database entry you have to run rails db:migrate on the production server.
from my cli
```
azeem@x9:~/alphazed$ railway login
> Open the browser? No
Browserless Login
Please visit:
https://railway.com/cli-login?d=REDACTED
Your pairing code is: REDACTED
Logged in as azeem.hussein@gmail.com
azeem@x9:~/alphazed$ railway run rails db:migrate
New version available: v4.10.0 visit https://docs.railway.com/guides/cli for more info
> Select a service to pull variables from alphazed
bin/rails aborted!
ActiveRecord::NoDatabaseError: We could not find your database: railway. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)
To resolve this error:
- Did you not create the database, or did you delete it? To create the database, run:
bin/rails db:create
- Has the database name changed? Verify that config/database.yml contains the correct database name.
Caused by:
PG::ConnectionBad: could not translate host name "postgres.railway.internal" to address: Name or service not known (PG::ConnectionBad)
```
I'm tired of brody gaslighting users. they never provided correct information.
DEAR IDIOTS. I CANNOT RUN A MIGRATION UNTIL THE NEW CODE IS DEPLOYED.
RUNNING A MIGRATION IS A POST DEPLOY COMMAND. POST. NOT PRE. POST.
i'm very frustrated because this has never been addressed and it is a core issue for anyone running any app.
3 Replies
2 months ago
Hey there! We've found the following might help you get unblocked faster:
🧵 Cannot access postgres.railway.internal and Rails build fails on migrate
🧵 Slowness in Console Operations and Migrations with Railway in Rails
If you find the answer from one of these, please let us know by solving the thread!
Railway
Hey there! We've found the following might help you get unblocked faster: - [🧵 Cannot access postgres.railway.internal and Rails build fails on migrate](https://station.railway.com/questions/cannot-access-postgres-railway-internal-99a5266d) - [🧵 How can i access rails console of prod app from my laptop](https://station.railway.com/questions/how-can-i-access-rails-console-of-prod-a-b9b207aa) - [🧵 Slowness in Console Operations and Migrations with Railway in Rails](https://station.railway.com/questions/slowness-in-console-operations-and-migra-284f5ae3) If you find the answer from one of these, please let us know by solving the thread!
2 months ago
yea "brody" never provided an answer in https://station.railway.com/questions/cannot-access-postgres-railway-internal-99a5266d
and i also tried loading shell variables via Vipul Sharma's attempt here https://station.railway.com/questions/how-can-i-access-rails-console-of-prod-a-b9b207aa and that also fails with the same errors.
Heroku literally lets us run console commands. rails db:migrate is just a command you run.
WHY THE FUCK IS YOUR TEAM SO STUPID AND WHY IS IT SO HARD TO GET BASIC SHIT DONE?! WTF
EVEN IF I COPY THE DATABASE PUBLIC URL IT STILL DOESNT WORK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I know this was your recommended solution because you didnt want to allow post deploy commands when i first joined this platform and had to migrate my old DB . YOUR TEAM never went beyond devops to make an app and it shows with how shitty your platform app works.
PROVE ME WRONG BY SHOWING ME EXACTLY WHERE POST DEPLOYMENT COMMANDS and shut my rude ass up. i bet you can't because you never added that feature, because you've never actually been an entrepeneur or a coder or devops guy. You've never run an app and it shows.
```
azeem@x9:~/alphazed$ railway shell
No service linked. Please link one with railway service
azeem@x9:~/alphazed$ railway link
> Select a workspace azeemh's Projects
> Select a project illustrious-adventure
> Select an environment production
> Select a service <esc to skip> alphazed
Project illustrious-adventure linked successfully! 
azeem@x9:~/alphazed$ railway run rails db:migrate
bin/rails aborted!
ActiveRecord::NoDatabaseError: We could not find your database: railway. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)
To resolve this error:
- Did you not create the database, or did you delete it? To create the database, run:
bin/rails db:create
- Has the database name changed? Verify that config/database.yml contains the correct database name.
Caused by:
PG::ConnectionBad: could not translate host name "postgres.railway.internal" to address: Name or service not known (PG::ConnectionBad)
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
azeem@x9:~/alphazed$ railway shell
Entering subshell with Railway variables available. Type 'exit' to exit.
azeem@x9:~/alphazed$ DATABASE_URL="postgresql://postgres:FFbJnVBkgVLQmrTtJtKTxumOLPZPqeAl@gondola.proxy.rlwy.net:13146/railway" railway run rails db:migrate
bin/rails aborted!
ActiveRecord::NoDatabaseError: We could not find your database: railway. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)
To resolve this error:
- Did you not create the database, or did you delete it? To create the database, run:
bin/rails db:create
- Has the database name changed? Verify that config/database.yml contains the correct database name.
Caused by:
PG::ConnectionBad: could not translate host name "postgres.railway.internal" to address: Name or service not known (PG::ConnectionBad)
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
```
2 months ago
when i first joined this platform i was told we shouldn't ssh.
it turns out that if you are using ruby on rails, you HAVE TO USE SSH TO run rails db:migrate and using any of the pre or other methods advocated in the forums will mess you up.
and none of the railway internal urls work from a railway cli session. you have to ssh otherwise it doesn't work. alot of the people on this app and forum give shitty advice.
writing this so other folks dont get bad advice.
```
azeem@x9:~/alphazed$ railway ssh
✓ Connected to interactive shell
root@a2b064140458:/app# rails db:migrate
I, [2025-10-19T15:39:58.943893 #80] INFO -- : Migrating to CreateActiveStorageTables (20251007185953)
== 20251007185953 CreateActiveStorageTables: migrating ========================
-- create_table(:active_storage_blobs, {:id=>:primary_key})
-> 0.0465s
-- create_table(:active_storage_attachments, {:id=>:primary_key})
-> 0.0272s
-- create_table(:active_storage_variant_records, {:id=>:primary_key})
-> 0.0186s
== 20251007185953 CreateActiveStorageTables: migrated (0.0927s) ===============
root@a2b064140458:/app# exit
exit
```
Status changed to Solved brody • about 2 months ago