Skip to content

Remis en place de la protection contre écriture sur BuildingHistory #642

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

pauletienney
Copy link
Contributor

Le fix sur la PR638 imposait de débrancher un mécanisme de protection contre l'écriture dans la building_history.

Cette PR remet en place cette protection.
Elle ajoute également une contrainte d'unicité sur le couple rnb_id / event_id dans la table building_history.

Il est possible que la mise en place de cette contrainte bloque l'accès à la table pendant un long moment. Je vais tester sur staging avant de mettre en place sur prod.

# if model == BuildingWithHistory or model == BuildingHistoryOnly:
# raise Exception("BuildingWithHistory model is read only!")

if model == BuildingWithHistory or model == BuildingHistoryOnly:
Copy link
Contributor

@leonkenneth leonkenneth Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'imagine que BuildingWithHistory restait read-only car c'est une view?

Peut-être ajouter un DBRouter.DANGEROUSLY_ALLOW_UPDATE_BUILDING_HISTORY plutôt que commenter ?

Notamment ça permettrait de le désactiver dans la migration mais pas dans le reste du code le temps du déploiement. Si on en a eu besoin une fois, c'est possible qu'on en ait besoin de nouveau.

Base automatically changed from fill_event_id to main July 8, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants