Skip to content

Commit

Permalink
Database schema (hackforla#528)
Browse files Browse the repository at this point in the history
* Update intro.md (hackforla#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 committed Jun 8, 2024
1 parent 1e448a4 commit c876eba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@

DATABASES = {
'default': {
'ENGINE':os.environ.get("SQL_ENGINE"),
'NAME': os.environ.get('SQL_DATABASE'),
'USER': os.environ.get('SQL_USER'),
'PASSWORD': os.environ.get('SQL_PASSWORD'),
'HOST': os.environ.get('SQL_HOST'),
'PORT': os.environ.get('SQL_PORT'),
'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
}
}

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
);

0 comments on commit c876eba

Please sign in to comment.