-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐘 Postgres #78
🐘 Postgres #78
Conversation
67d8930
to
ebc2afb
Compare
README.md
Outdated
@@ -58,6 +72,9 @@ Unit tests and pep8 linting is run via `flask test` | |||
``` | |||
# Install test dependencies | |||
pip install -r dev-requirements.txt | |||
# Setup test database | |||
docker run --name dataservice-pg -p 5432:5432 -d postgres | |||
docker exec dataservice-pg psql -U postgres -c "CREATE DATABASE dev;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be "CREATE DATABASE test;"
right?
README.md
Outdated
@@ -21,12 +21,18 @@ pip install -r requirements.txt | |||
# Configure the flask application | |||
export FLASK_APP=manage | |||
# Setup the database | |||
flask db init | |||
docker run --name dataservice-pg -p 5432:5432 -d postgres:9.5 | |||
docker exec dataservice-pg psql -U postgres -c "CREATE DATABASE dev;" | |||
flask db upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add a line above here with flask db migrate
, otherwise the relations don't exist on the first time you try to run the app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a couple minor comments on test_errors.py and the README.md
tests/test_errors.py
Outdated
assert message in response['_status']['message'] | ||
|
||
|
||
def test_unique(self, client): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be called test_unique_demographic since its specific to the demographic and we could have other one-to-one entity tests in this class.
tests/test_errors.py
Outdated
|
||
|
||
def test_unique(self, client): | ||
""" Test integrity errors trying to break one-many with many-many """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
""" Test integrity errors trying to break one-to-one with one-to-many """
since a participant can only have on demographic and a demographic can only be related to one participant?
fb1b48c
to
d2330d9
Compare
dda1101
to
f3c74aa
Compare
bin/initdb.sh
Outdated
@@ -0,0 +1,3 @@ | |||
#!/bin/bash | |||
flask db upgrade | |||
flask db migrate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be migrate first then upgrade?
bin/run.sh
Outdated
#!/bin/bash | ||
source venv/bin/activate | ||
flask db upgrade | ||
flask db migrate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I think migrate first then upgrade
5b0b6bc
to
b34ba26
Compare
version: '3' | ||
|
||
services: | ||
pg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we expose the pg port so that people can use other apps like pgadmin to connect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not to avoid any conflict with local instances. Someone familiar enough to be connecting to the db should be able to figure out how to expose the port here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Reworks configuration, Jenkins pipeline, CircleCI, error handling, and secret management for operation with Postgres.
Fixes #28,
Fixes #29
Fixes #76