UVicMartletplace / martletplace

Recreating FB Marketplace for Students - UVic SENG499 Capstone Project
0 stars 0 forks source link

Brent/backend64 setup database tables #127

Closed bmachado18 closed 3 months ago

bmachado18 commented 3 months ago

Description

Created the main database tables almost as specified in the data entities section of the SRS 1.0. These are created within the initdb.sql file, where the docker container is initializing the database on each built. I'm curious how to manage persistent storage.

Notes:

I'm not sure how Resops wants to handle persistant storage, I could've mounted something but I am unsure. It also feels weird to push a big storage mount like that.

Closes #64

How to Test

  1. close all docker images: docker-compose down -v

  2. Run database image: docker-compose up -d database

  3. Access postgreSQL server through psql on host: psql -p 8310 -U martletplace -h localhost

  4. Enter the password (see the docker-compose.yml for pw, under database)

  5. connect to marketplace and view all tables

    \c martletplace
    \dt

Checklist

bmachado18 commented 3 months ago

I forgot the build flag, I'll change it back.

I'm curious, why not also just copy the file in the image for the populatedb.sql?

MNThomson commented 3 months ago

I'm curious, why not also just copy the file in the image for the populatedb.sql?

In the production environment, we don't want the db to be populated with dev/testing data. Since the Dockerfile is a source of truth for all environments, we use the docker compose volume mounts to add development only files.