How do we add foreign keys to our database tables on Railway?
mike-benn
HOBBYOP

2 years ago

I'm admittedly a beginner so I apologize if this is a very obvious question.

I was making a new table on the website under my database and was wanting to make foreign keys to one of my other tables but there is only a few options available, primary key, not null, and unique under constraints. Am I missing something?

Solved

7 Replies

mike-benn
HOBBYOP

2 years ago

N/A


2 years ago

I don't think the UI offers this functionality, it's only meant as a simple way to view your data.

Instead, I recommend deploying the dbgate template into your project and using that to manage your database.


mike-benn
HOBBYOP

2 years ago

Do we just use the public database url when connecting with dbgate or is there a way to use the internal one? A bit confused because it gives the warning about egress fees for using the public url


2 years ago

use the private url


mike-benn
HOBBYOP

2 years ago

Error: getaddrinfo ENOTFOUND postgres.railway.internal

at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)

Error JSON: {

"errno": -3008,

"code": "ENOTFOUND",

"syscall": "getaddrinfo",

"hostname": "postgres.railway.internal"

}

Connection: {

"server": "", "engine": "postgres@dbgate-plugin-postgres", "user": "",

"password": "", "unsaved": true, "_id": "",

"useDatabaseUrl": "", "databaseUrl": ""

}

Platform: darwin

Getting this error from using the private url, public works fine


2 years ago

per my first message in this thread, deploy the dbgate template into your project on Railway


2 years ago

!s


Status changed to Solved brody over 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...