From 74f81ce6d2547b3dad483ba830ad62db9172fada Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 12 Mar 2023 22:18:46 +0100 Subject: [PATCH] Fix migration script --- migrations/versions/ae9bb0feea7a_contraintes_identite.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migrations/versions/ae9bb0feea7a_contraintes_identite.py b/migrations/versions/ae9bb0feea7a_contraintes_identite.py index 4688f92ff4..6ab0514417 100644 --- a/migrations/versions/ae9bb0feea7a_contraintes_identite.py +++ b/migrations/versions/ae9bb0feea7a_contraintes_identite.py @@ -38,8 +38,8 @@ def upgrade(): for dept_id, code_nip in dups: etuds_dups = session.execute( """SELECT id, nom, prenom FROM identite - WHERE code_nip=:code_nip""", - {"code_nip": code_nip}, + WHERE dept_id=:dept_id AND code_nip=:code_nip""", + {"dept_id": dept_id, "code_nip": code_nip}, ).all() for i, (etudid, nom, prenom) in enumerate(etuds_dups[1:], start=1): session.execute( @@ -64,8 +64,8 @@ def upgrade(): for dept_id, code_ine in dups: etuds_dups = session.execute( """SELECT id, nom, prenom FROM identite - WHERE code_ine=:code_ine""", - {"code_ine": code_ine}, + WHERE dept_id=:dept_id AND code_ine=:code_ine""", + {"dept_id": dept_id, "code_ine": code_ine}, ).all() for i, (etudid, nom, prenom) in enumerate(etuds_dups[1:], start=1): session.execute(