Repository navigation
Candidat : Ajout d'une contrainte pour la cohérence entre le pays et la ville de naissance - #6765
Merged
Merged
Conversation
rsebille
commented
Sep 1, 2025
rsebille
force-pushed
the
rsebille/birthplace-constraint
branch
from
September 1, 2025 14:17
3d33880 to
201a3fb
Compare
EwenKorr
reviewed
Sep 1, 2025
EwenKorr
left a comment
Contributor
There was a problem hiding this comment.
J'étais dessus aussi mais je viens d'apprendre par l'expérience qu'on ne peut pas naviguer dans les relations dans les contraintes.
Ta solution de test pour vérifier que la PK de la France ne change pas est bonne !
Vu qu'on s'est rendu compte via une saisie dans l'admin j'aurais peut-être ajouté un test dans tests/users/test_admin.py aussi ?
rsebille
force-pushed
the
rsebille/birthplace-constraint
branch
2 times, most recently
from
September 4, 2025 10:07
0a4b74a to
5e07691
Compare
xavfernandez
reviewed
Sep 4, 2025
rsebille
force-pushed
the
rsebille/birthplace-constraint
branch
from
September 4, 2025 14:25
5e07691 to
f3e6919
Compare
EwenKorr
reviewed
Sep 8, 2025
rsebille
force-pushed
the
rsebille/birthplace-constraint
branch
from
September 8, 2025 13:58
f3e6919 to
0d582c6
Compare
xavfernandez
approved these changes
Sep 8, 2025
EwenKorr
approved these changes
Sep 9, 2025
rsebille
force-pushed
the
rsebille/birthplace-constraint
branch
from
September 9, 2025 12:40
0d582c6 to
5eddff7
Compare
We are going to use it in a `CHECK` constraint so getting it at runtime will not be possible anymore.
This will prevent possible nasty bugs if the INSEE code and the PK are desynchronized, and it's more likely to break something if it does. > There should be one-- and preferably only one --obvious way to do it.
rsebille
force-pushed
the
rsebille/birthplace-constraint
branch
from
September 15, 2025 07:36
5eddff7 to
579ffb3
Compare
rsebille
added this pull request to the merge queue
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 Pourquoi ?
Cette règle métier est vérifiée dans les formulaires mais pas dans l'admin, et donc parfois on se tombe sur un os suite à une modification manuelle, ce qui bloque ensuite la transmission des FS,
A noter qu'actuellement nous n'avons aucun cas en erreur ;).
🍰 Comment ?
Une contrainte
CHECKn'a accès qu'au du tuple inséré donc je fige la PK debirth_countrydans la contrainte et ajoute des tests afin de détecter un changement de clé primaire.J'aime pas spécialement mais vu que c'est un référentiel et que ça vient d'une fixture ça me semble tout de même acceptable si ça nous évite des incohérences de données (que j'aime encore moins 😁).