Open laurentS opened 1 year ago
@laurentS Adding some more detail on this issue.
initdb.sql
is used by Postgres on initialization (first start-up).set_up_db.sql
is defined for mapswipe_worker, it is used to create a temporary database for testing.set_up_db.sql
Currently, we have a hybrid way of running test cases.
set_up_db.sql
which is initiated and deleted after the test run.
Django has a good data migration pipeline. And We have already set up and defined initial migrations in the Django server which is used by the community dashboard. Maybe we can move the python-worker functionality to the Django server and use Django to create/update the database instead of using raw SQL. This will create a better pipeline for testing and database change management.
@thenav56 I agree that the isolated test db is great, no questions there. My concern was more around the duplicated source of truth for the db schema (the 2 files above), as it's easy to have the 2 files diverge in content.
I'm conscious it's not obvious how to merge these 2 files due to docker
build environment constraints, which is why I haven't offered a solution :)
Using django's migration system should fix this indeed.
There are 2 files:
initdb.sql
set_up_db.sql
which contain the exact same definition. There should be a way to have a single source of truth, remove one of them.