From c6fc46e0e2274c3326ea94c6419e3773d363497a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 15 Aug 2021 22:20:07 +0200 Subject: [PATCH] =?UTF-8?q?modif=20contraintes=20pour=20codes=20NIP=20et?= =?UTF-8?q?=20INE=20si=20m=C3=AAme=20=C3=A9tudiant=20dans=20plusieurs=20de?= =?UTF-8?q?pt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/etudiants.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 1756ae329..674e9e8ca 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -14,6 +14,10 @@ class Identite(db.Model): """étudiant""" __tablename__ = "identite" + __table_args__ = ( + db.UniqueConstraint("dept_id", "code_nip"), + db.UniqueConstraint("dept_id", "code_ine"), + ) id = db.Column(db.Integer, primary_key=True) etudid = db.synonym("id") @@ -33,8 +37,9 @@ class Identite(db.Model): statut = db.Column(db.Text()) boursier = db.Column(db.Boolean()) # True si boursier ('O' en ScoDoc7) photo_filename = db.Column(db.Text()) - code_nip = db.Column(db.Text(), unique=True) - code_ine = db.Column(db.Text(), unique=True) + # Codes INE et NIP pas unique car le meme etud peut etre ds plusieurs dept + code_nip = db.Column(db.Text()) + code_ine = db.Column(db.Text()) class Adresse(db.Model):