Database
The API communicates with a PostgreSQL database using TypeORM.
We highly recommend consulting the NestJS TypeORM documentation for a comprehensive understanding of its functionality.
Configuration
All database-related code resides in the src/core/database
folder.
Migrations
In the development environment, the database schema is automatically synchronized, requiring no manual intervention. However, for other environments, SQL migrations need to be generated and executed.
- Update your
.env
file with your production url.
SERVER_DATABASE_URL=your-production-url
- Generate migration files
pnpm run --filter server database:migration:build
TypeORM compares the differences between your codebase entities and the target database schema, creating and storing an SQL script in the src/core/database/migrations
folder.
- Run migrations files on the target database
pnpm run --filter server database:migration:run
PgAdmin
A PgAdmin instance is accessible at https://localhost:5052.
Authentication
Credential | Value |
---|---|
User email | admin@admin.com |
User password | root |
Register your server
- Right click on
Servers
, then click onRegister
>Server...
- On Docker Desktop, copy the name of your PostgreSQL service.
- Back in PgAdmin, configure your server connection details.
Key | Value |
---|---|
Connection > Host name/address | XXXXXX-<your-slug>-postgresql |
Connection > Port | 5432 |
Connection > Username | root |
Connection > Password | root |
Ensure that the Host name/address matches your Docker PostgreSQL service name.