How do we add foreign keys to our database tables on Railway?

mike-bennTRIAL

5 months 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

0 Replies

mike-bennTRIAL

5 months ago

N/A


5 months 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-bennTRIAL

5 months 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


5 months ago

use the private url


mike-bennTRIAL

5 months ago

Error: getaddrinfo ENOTFOUND postgres.railway.internal
at GetAddrInfoReqWrap.onlookupall as oncomplete

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


5 months ago

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


5 months ago

!s


Status changed to Solved brody 5 months ago