Skip to content

Commit

Permalink
Database schema (#528)
Browse files Browse the repository at this point in the history
* Update intro.md (#512)

Hey updated a few steps for onboarding under the intro.

* init sql file to create post table

* Updated docker to create postgres database

- updated git ignore to include /data directory

* Updated dev.env example

- found bug that prevented postgres from connecting

---------

Co-authored-by: kchotani <[email protected]>
  • Loading branch information
bennyv8 and kchotani authored Apr 19, 2024
1 parent 379ea51 commit b3c0750
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ app/frontend/static/frontend/*
!app/frontend/static/frontend/.gitkeep
app/frontend/templates/frontend/*
!app/frontend/templates/frontend/.gitkeep
data/

**/super-linter.log
app/staticfiles
Expand Down
16 changes: 9 additions & 7 deletions backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,19 @@
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

DATABASES = {
"default": {
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
"USER": os.environ.get("SQL_USER", "user"),
"PASSWORD": os.environ.get("SQL_PASSWORD"),
"HOST": os.environ.get("SQL_HOST", "localhost"),
"PORT": os.environ.get("SQL_PORT", "5432"),
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get('POSTGRES_NAME'),
'USER': os.environ.get('POSTGRES_USER'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': 'pgdb',
'PORT': 5432, #default port you don't need to mention in docker-compose
}
}




# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

Expand Down
15 changes: 15 additions & 0 deletions data/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE SCHEMA PostDatabase;


CREATE TABLE Post (
id UUID PRIMARY KEY,
role VARCHAR,
subrole VARCHAR,
project VARCHAR,
meetings_times VARCHAR[],
difficulty_level INT,
details JSONB,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_by_or_token VARCHAR
);
2 changes: 1 addition & 1 deletion dev/dev.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environment file to configure docker containers

# postgres
POSTGRES_DB=<same as SQL_DATABASE>
POSTGRES_NAME=<same as SQL_DATABASE>
POSTGRES_USER=<same as SQL_USER>
POSTGRES_PASSWORD=<same as SQL_PASSWORD>

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ services:
image: postgres
container_name: pgdb
volumes:
- postgres_data:/lib/postgresql/data
- ./data/init.sql:/docker-entrypoint-initdb.d/init.sql
env_file:
- ./dev/dev.env


django:
build:
context: ./backend
Expand Down Expand Up @@ -56,5 +57,4 @@ services:
- ${HOME}/.cache:${HOME}/.cache:rw

volumes:
postgres_data:
node_modules:
9 changes: 5 additions & 4 deletions docs/joining-the-team/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ Welcome to the Civic Tech Jobs team! This guide will help get you up to speed on

If you have not read the [Guide for New Volunteers](https://www.hackforla.org/getting-started), please do so.

1. Read [Introduction to the Project](https://hackforla.github.io/CivicTechJobs/) if you haven't already read it.
1. Join the [Civic Tech Jobs](https://hackforla.slack.com/archives/C02509WHFQQ) Slack channel and introduce yourself and mention the role you are interested in. Our PM's [Joyce Guo](https://hackforla.slack.com/team/U05JUKMMVDJ) & [Sabrina Heasley](https://hackforla.slack.com/team/U05GDBDPEDR) will help you get onboarded with the following steps.
1. Complete this form [Team Roster Onboarding Form](https://docs.google.com/forms/d/e/1FAIpQLSfv-VTLseKixhzbPvY_hBHW30CaokUh4FOmst-4ZEM639EinQ/viewform) and inform PM after you have done so.
1. Check the [Community of Practice -> Open Roles Board](https://github.com/hackforla/communities-of-practice) for current open roles in the Civic Tech Jobs project.
2. Read [Introduction to the Project](https://hackforla.github.io/CivicTechJobs/) if you haven't already read it.
3. If interested in joining the team, complete this form [Team Roster Onboarding Form](https://docs.google.com/forms/d/e/1FAIpQLSfv-VTLseKixhzbPvY_hBHW30CaokUh4FOmst-4ZEM639EinQ/viewform).
4. Join the [Civic Tech Jobs](https://hackforla.slack.com/archives/C02509WHFQQ) Slack channel and introduce yourself and mention the role you are interested in. Our PM's will help you get onboarded with the following steps.
1. Accept your Google Drive invite to access the [shared folder](https://drive.google.com/drive/u/0/folders/0AMdnUkSXicNCUk9PVA).
1. Review the [Glossary](https://hackforla.github.io/CivicTechJobs/misc/glossary/).
1. Attend our weekly meetings on Tuesdays at 5pm PST. You can find the link pinned in our slack channel.
1. Attend our monthly all team meeting on the third Tuesday at 5pm PST. You can find the link pinned in our slack channel.

---

Expand Down

0 comments on commit b3c0750

Please sign in to comment.