PostgreSQL
The Railway PostgreSQL database service allows you to provision and connect to a PostgreSQL database with zero configuration.
Connect
There are two ways to connect to a PostgreSQL database:
- Add a Reference Variable to a service
- Run
railway connect
to start apsql
shell
The following variables can be referenced in your services:
PGHOST
PGPORT
PGUSER
PGPASSWORD
PGDATABASE
DATABASE_URL
Note, Many libraries will automatically look for the DATABASE_URL
variable and use
it to connect to PostgreSQL but you can use these variables in whatever way works for you.
Image
The Postgres database service uses the timescale/timescaledb-postgis:latest-pg13 docker image.
Timescale and PostGIS
All PostgreSQL containers have the PostGIS and Timescale family of extensions installed. This means you can do both geo-spatial and time-series queries out of the box with Railway!
You must enable the extensions in every database you want to use them. For example,
Edit this file on GitHub