A starter repository for the Database Course project. Design, implement, and evaluate a relational database for an e-commerce application.
- Docker with Docker Compose
- Git
- A PostgreSQL client (optional)
-
Copy
.env.exampleto.env. -
Change the database password in
.env. -
Start PostgreSQL:
docker compose up -d
-
Connect to the database:
docker compose exec db psql -U student -d ecommerce -
Stop PostgreSQL:
docker compose down
- PostgreSQL 18: Uses the current major version specified in the image tag. For reproducible grading, the instructor can later pin an exact image version or digest.
- Persistent storage:
postgres_datakeeps database files when the container is stopped or recreated. - Initialization scripts: SQL files in
sql/init/run only when PostgreSQL initializes an empty data directory. - Health check:
pg_isreadylets Docker report when PostgreSQL is ready to accept connections. - Environment variables: Compose reads the local
.envfile, which should not be committed to Git.
Important: PostgreSQL 18 uses /var/lib/postgresql as the recommended volume mount target for its official image. This differs from the mount path commonly used with older PostgreSQL image versions.
After creating .env from .env.example, run:
docker compose up -d
docker compose psConnect using:
docker compose exec db psql -U student -d ecommerceTo stop the database without deleting its data:
docker compose downTo delete the database and its persistent data, use docker compose down -v. This permanently removes the stored database, so students should use it only when they intentionally want a clean environment.
sql/— schema, queries, and tests.scripts/— data generation and testing utilities.docs/— design documents, diagrams, and reports.
See the course assignment for project requirements.
Note: This repository provides the development environment, not a completed database implementation.