Fix: "Code" longueur max = 32

This commit is contained in:
Éric Li 2021-06-11 14:34:43 +02:00
parent 564af1ea69
commit 9adb5a6292

View File

@ -1,28 +1,28 @@
from app import db
Semestres_Competences = db.Table("Semestres_Competences",
db.Column("Semestre_num", db.String(1), db.ForeignKey("semestre.num")),
db.Column("Competence_code", db.String(3), db.ForeignKey("competence.code"))
db.Column("Semestre_num", db.String(32), db.ForeignKey("semestre.num")),
db.Column("Competence_code", db.String(32), db.ForeignKey("competence.code"))
)
ACs_Competences = db.Table("ACs_Competences",
db.Column("AC_code", db.String(6), db.ForeignKey("AC.code")),
db.Column("Competence_code", db.String(3), db.ForeignKey("competence.code"))
db.Column("AC_code", db.String(32), db.ForeignKey("AC.code")),
db.Column("Competence_code", db.String(32), db.ForeignKey("competence.code"))
)
Ressources_ACs = db.Table("Ressources_ACs",
db.Column("Ressource_code", db.String(4), db.ForeignKey("ressource.code")),
db.Column("AC_code", db.String(6), db.ForeignKey("AC.code"))
db.Column("Ressource_code", db.String(32), db.ForeignKey("ressource.code")),
db.Column("AC_code", db.String(32), db.ForeignKey("AC.code"))
)
Ressources_SAEs = db.Table("Ressources_SAEs",
db.Column("Ressource_code", db.String(4), db.ForeignKey("ressource.code")),
db.Column("SAE_code", db.String(5), db.ForeignKey("SAE.code"))
db.Column("Ressource_code", db.String(32), db.ForeignKey("ressource.code")),
db.Column("SAE_code", db.String(32), db.ForeignKey("SAE.code"))
)
SAEs_ACs = db.Table("SAEs_ACs",
db.Column("SAE_code", db.String(5), db.ForeignKey("SAE.code")),
db.Column("AC_code", db.String(6), db.ForeignKey("AC.code"))
db.Column("SAE_code", db.String(32), db.ForeignKey("SAE.code")),
db.Column("AC_code", db.String(32), db.ForeignKey("AC.code"))
)
class Semestre(db.Model):
@ -38,7 +38,7 @@ class Semestre(db.Model):
return "<Semestre {}>".format(self.num)
class Competence(db.Model):
code = db.Column(db.String(3), primary_key = True, info={'label': 'Code'})
code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'})
nom = db.Column(db.String(255), info={'label': 'Nom'})
diminutif = db.Column(db.String(30), info={'label': 'Diminutif'})
description = db.Column(db.Text(), info={'label': 'Description'})
@ -85,8 +85,8 @@ class Competence(db.Model):
return "<Competence {}>".format(self.code)
class CoefSAE(db.Model):
competence_code = db.Column(db.String(3), db.ForeignKey("competence.code"), primary_key=True)
sae_code = db.Column(db.String(6), db.ForeignKey("SAE.code"), primary_key=True)
competence_code = db.Column(db.String(32), db.ForeignKey("competence.code"), primary_key=True)
sae_code = db.Column(db.String(32), db.ForeignKey("SAE.code"), primary_key=True)
coef = db.Column(db.String(2))
competence = db.relationship("Competence", lazy=False, backref=db.backref("saes"))
sae = db.relationship("SAE", lazy=False, backref=db.backref("competences"))
@ -97,8 +97,8 @@ class CoefSAE(db.Model):
return result
class CoefRessource(db.Model):
competence_code = db.Column(db.String(3), db.ForeignKey("competence.code"), primary_key=True)
ressource_code = db.Column(db.String(4), db.ForeignKey("ressource.code"), primary_key=True)
competence_code = db.Column(db.String(32), db.ForeignKey("competence.code"), primary_key=True)
ressource_code = db.Column(db.String(32), db.ForeignKey("ressource.code"), primary_key=True)
coef = db.Column(db.String(2))
competence = db.relationship("Competence", lazy=False, backref=db.backref("ressources"))
ressource = db.relationship("Ressource", lazy=False, backref=db.backref("competences"))
@ -109,7 +109,7 @@ class CoefRessource(db.Model):
return result
class AC(db.Model):
code = db.Column(db.String(6), primary_key = True, info={'label': 'Code'})
code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'})
titre = db.Column(db.String(255), info={'label': 'Titre'})
saes = db.relationship("SAE", secondary=SAEs_ACs, lazy=False, backref=db.backref("acs", lazy=False))
ressources = db.relationship("Ressource", order_by="Ressource.code", secondary=Ressources_ACs, lazy=False, backref=db.backref("acs", lazy=False))
@ -126,7 +126,7 @@ class AC(db.Model):
return "<AC {}>".format(self.code)
class PN(db.Model):
code = db.Column(db.String(3), primary_key = True, info={'label': 'Code'})
code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'})
nom = db.Column(db.String(255), info={'label': 'Nom'})
diminutif = db.Column(db.String(30), info={'label': 'Diminutif'})
description = db.Column(db.Text(), info={'label': 'Description'})
@ -141,7 +141,7 @@ class PN(db.Model):
return "<PN {}>".format(self.code)
class SAE(db.Model):
code = db.Column(db.String(5), primary_key = True, info={'label': 'Code'})
code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'})
titre = db.Column(db.String(255), info={'label': 'Titre'})
semestre = db.Column(db.String(255), info={'label': 'Semestre'})
heures_encadrees = db.Column(db.String(3), info={'label': 'Heures Encadrées'})
@ -173,7 +173,7 @@ class SAE(db.Model):
return "<SAE {}>".format(self.code)
class Ressource(db.Model):
code = db.Column(db.String(4), primary_key = True, info={'label': 'Code'})
code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'})
nom = db.Column(db.String(255), info={'label': 'Nom'})
semestre = db.Column(db.String(255), info={'label': 'Semestre'})
heures_formation = db.Column(db.String(3), info={'label': 'Heures Formation'})