mapswipe / python-mapswipe-workers

MapSwipe Back-End
https://mapswipe-workers.readthedocs.io
Apache License 2.0
26 stars 11 forks source link

Remove duplicate database schema definitions #601

Open laurentS opened 1 year ago

laurentS commented 1 year ago

There are 2 files:

which contain the exact same definition. There should be a way to have a single source of truth, remove one of them.

thenav56 commented 1 year ago

@laurentS Adding some more detail on this issue.

Usages

Reason behind set_up_db.sql

Currently, we have a hybrid way of running test cases.

Proposed solution.

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.

laurentS commented 1 year ago

@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.