goat icon indicating copy to clipboard operation
goat copied to clipboard

Database/Model refactors which need migration

Open metemaddar opened this issue 3 years ago • 4 comments

Here we can add database and model refactors that need migrations. After having enough refactor list, we would fix them. This can help us have more integrated changes and less migration revisions.

metemaddar avatar Aug 15 '22 09:08 metemaddar

unique constraint for (group <---> category) at basic.opportunity_study_area_confifg

As each category belongs to one group maybe we need to unique these two. But as we have different study areas maybe we should have constraint for (group <---> category <---> study_area) However this can make our table complex. So maybe needs more discussion about it.

metemaddar avatar Aug 15 '22 09:08 metemaddar

refactor foreign key at customer.layer_library.source_{1,2} to connect to customer.layer_source.id

Now these two foreign keys are connected to layer_source.name. As layer_source.name is long, we can refactor to connect to id so that the objects and requests can be more clean. This also needs to change the endpoints to query source field while querying the layer_library itself.

metemaddar avatar Aug 15 '22 09:08 metemaddar

unique constraint for (group <---> category) at basic.opportunity_study_area_confifg

As each category belongs to one group maybe we need to unique these two. But as we have different study areas maybe we should have constraint for (group <---> category <---> study_area) However this can make our table complex. So maybe it needs more discussion about it.

Yes I also believe (group <---> category <---> study_area) is better. As it could be that we change the groups. So this combination should be really unique. We currently already have a unique key category <---> study_area. I believe we would need the other one in addition.

EPajares avatar Aug 16 '22 06:08 EPajares

I am also unhappy with this. Also the style table uses the name. We did this kind of very fast without thinking enough and when doing it one requirement was to be able adding the information fast to the DB table using Dbeaver. Now as we have the endpoints this is not needed anymore.

EPajares avatar Aug 16 '22 06:08 EPajares