Fix migration script

This commit is contained in:
Emmanuel Viennet 2023-03-12 22:18:46 +01:00
parent b5b606b1f6
commit 74f81ce6d2

View File

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