This document explains how to set up and configure the database for development and testing purposes.
There are two ways to set up a database for development:
The easiest way to get started is using Docker with the default configuration:
npm run docker-devThis command will:
- Start the database container using Docker Compose
- Use the default configuration settings
- Set up the database ready for development
For a local MariaDB setup, you'll need to install MariaDB on your system first.
Installation Guide: MariaDB Getting Started
After installing MariaDB locally, configure your application to connect to your local database instance by updating the appropriate configuration files.
For running tests, Docker must be installed and running on your system.
To set up the test database:
npm run docker-testThis command will:
- Start a test database container
- Automatically seed the database with mock data prepared specifically for testing
- Ensure a clean testing environment
For development purposes, you can seed the database with mock data by setting forceSeed to true in your configuration.
Important Notes:
- When
forceSeedis enabled, seeding will execute every time the server reloads - The
dropproperty will clean all data from the database if set totrueevery time the server reloads - Use these options carefully to avoid unintended data loss
Database migrations will be executed automatically if they haven't been run before.
Clean Setup Recommendation: For a completely clean database setup, it's recommended to run:
docker compose down database -vAnd delete all existing data.
WARNING: Only perform this clean setup the first time or when you specifically need to reset everything, as it will permanently delete all database data.
Important: The database is currently not being used by the application or tests, as the services and controllers are not yet configured to utilize the database layer. This functionality is planned for future implementation.
npm run docker-dev- Start development databasenpm run docker-test- Start test database with mock datadocker compose down database -v- Clean database setup (removes all data)