From 095a25b59c52f4c40880d6ae9bf6fd575bfb4392 Mon Sep 17 00:00:00 2001 From: Nekori Date: Wed, 9 Jun 2021 10:21:19 +0200 Subject: [PATCH] Ajout des coefs --- README.md | 3 +- app.db | Bin 90112 -> 98304 bytes app/forms.py | 10 ++- app/models.py | 78 +++++++++++++----- app/routes.py | 27 ++++-- app/templates/Ressource.html | 1 - app/templates/SAE.html | 1 - app/templates/semestre.html | 30 ++++--- migrations/versions/03ec797adcc8_.py | 38 --------- .../{15feabeae315_.py => 7e3f15e7d9d0_.py} | 45 ++++++++-- migrations/versions/8b0862eb0856_.py | 40 --------- migrations/versions/cff96c022884_.py | 33 -------- 12 files changed, 147 insertions(+), 159 deletions(-) delete mode 100644 migrations/versions/03ec797adcc8_.py rename migrations/versions/{15feabeae315_.py => 7e3f15e7d9d0_.py} (66%) delete mode 100644 migrations/versions/8b0862eb0856_.py delete mode 100644 migrations/versions/cff96c022884_.py diff --git a/README.md b/README.md index 2073093..0430159 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,5 @@ ### Pour lancer l'app - flask run \ No newline at end of file + flask run + diff --git a/app.db b/app.db index a80baa8526ec218a52bac8e51684ade6a35b1894..c5fec6320e616c100b05373687c786bb07fb7f26 100644 GIT binary patch delta 1234 zcma)6TSyd97@o5`JF_#pGyl5lI_j=DYd1H{W~~$}kjXZ>n98PsPn)er5Zkm}gUA;Z zd+u@`dX$2~Ub?t+GeN;933@0(if$@JL1;H2-|Wn~Yi>kzU^w&t|Mz|W{~gXu&zPmB zhdZ0^WORmMa_N&^^0|_-9W+~7JubllqoDf?NN`U+C4Z6zyObl}!-49DXgCt{I5BBeSM z)Ek0ogTAvSsAeM7Vo`{6L_2X8J{G}Y@>KGQ%Q9giir(!8K|Q30s`u!j;xd1UDhl<+?iMoQXn%(e6ozz-ZkxJGf|ArYfa$P9owkw=c=OzmpX3 zUgRR%_!}sTeC9VGC&{rsMh-Gq(wc97l1y zi=KOGm&qk=50c4euG9v7J{zwT7NY(v@{QB!fYa|ej3Q^nLKWUfwwS1wQqo^nyjvhB%6#3 zqT=K-?0Po<28F&N3RN)#}d?wMoncN;-W%nWamYRf2 zk19iBtm77oOsY7+z<26r5+*3;F35J)oafT3HBAf9J{KmdP^r}fGYou#8H$($GV`t| z!5%g_xG4s{!W2zD2Qsy|hQj6yJ9E^|3|yGogmSD1zNMKjVLhb(6m*vm>r#NWFpfs*qxQJf)Z;C=z+8egyg delta 1028 zcmZuvOH30{6rI%?7U|LAfh2ghw zr{*nKx>3QEq$MVj7>Lz`5HTpGY9NN7L@+|+ljsg#2O2){CG$S_o;l~d`)*ek-!-Pb zpJqnQ48z#yml%!*dG1mgE$~J~_{&&TwG4>x!f@NLC=MDf>#N0X-EsZFq<1<&^Ho?B z()eC}N!`kIvNfvOh{-sPD!Xr41t~ut^*Y<@>Tlpn9$)CHx2@$SZpW<+IJEz4^ZI?B zfX@-|oH_4vWbI3nU+PpcsVO8E)ThZ6A=}@Ro-9aZWvKU}!tTeRP+Lck^6u97f7H5H zDFGs@Tr!FADcdsTXk=TrrK#ax?ZuqabBwqV9CXK?t|t zP2H3 z;&ZdUv|cVPc4Imh6^9)gus0yT2jq@?C_g4^h8dWFVVIy#_XKL3DxGu~wg-I)*>x6o zbT&r^Td;#3>*^aCanrTy*+?g4?}o`$LEO@egS$am+EOZ5X5bGj!#B$R8BiwqanH_& z8TbNWMX}PU(pX9qDu2MeBi2CsCHhop7)8{Hc3>_=EIJs(j(xDm=0m~A4>9l&hA90b z;ImXZYoSO+M-SxXBDzhO_RI2?XN4xw2{>`V@EB**vM|lSD$K()<$41kvaB^V{-eiB zCs+SGpe!E28Ut$)Q`I75=n-p`;(&PNWRc#Vg((Jp!yHUeidSGXu&k7-WVboyj-o>m zZc63Q&c+M10t+xpp>M$~a4cBdv?v0*wQ=>Ylp`B;6{CXi9byzW4kWf&Kuv5gut81y g1e=zcu*6OH1FpCQ1nUf})7%n>I>bsAMV==A0g_}bumAu6 diff --git a/app/forms.py b/app/forms.py index 8025ff2..bc909cb 100644 --- a/app/forms.py +++ b/app/forms.py @@ -38,11 +38,16 @@ class AccueilForm(FlaskForm): exporter = SubmitField("Exporter") importer = SubmitField("Importer") +class CoefForm(FlaskForm): + objetformation = HiddenField("Objet de formation") + coef = StringField("Coef") + class UEForm(FlaskForm): ue = HiddenField("Competence") acs = RefListField("Liste des ACs", query_factory=lambda: models.AC.query.all(), get_label=lambda ref: ref.getLabel()) ressources = RefListField("Liste des Ressources inclus dans les ACs", query_factory=lambda: [], get_label=lambda ref: ref.getLabel()) saes = RefListField("Liste des SAEs inclus dans les ACs", query_factory=lambda: [], get_label=lambda ref: ref.getLabel()) + coef = FieldList(FormField(CoefForm)) class SemestreForm(FlaskForm): ues = RefListField("Liste des UEs", query_factory=lambda: models.Competence.query.all(), get_label=lambda ref: ref.getLabel()) @@ -119,7 +124,7 @@ class Form(ModelForm): model = getattr(models, self.__class__.__name__[:-4]) referentiel = model.query.filter_by(code=self.code.data).first() if referentiel == None: referentiel = model() - self.populate_obj(referentiel) + self.populate_obj(referentiel) db.session.add(referentiel) db.session.commit() @@ -128,7 +133,8 @@ class PNForm(Form): class Meta: model = models.PN - type_map = ClassMap({ChoiceType: RadioField}) + + type = RadioField("Type", choices=["1","2","3"]) class ACForm(Form): diff --git a/app/models.py b/app/models.py index 9aa1c46..f3c0609 100644 --- a/app/models.py +++ b/app/models.py @@ -1,5 +1,4 @@ from app import db -from sqlalchemy_utils import ChoiceType Semestres_Competences = db.Table("Semestres_Competences", db.Column("Semestre_num", db.String(1), db.ForeignKey("semestre.num")), @@ -11,16 +10,6 @@ ACs_Competences = db.Table("ACs_Competences", db.Column("Competence_code", db.String(3), db.ForeignKey("competence.code")) ) -SAEs_Competences = db.Table("SAEs_Competences", - db.Column("SAE_code", db.String(6), db.ForeignKey("SAE.code")), - db.Column("Competence_code", db.String(3), db.ForeignKey("competence.code")) -) - -Ressources_Competences = db.Table("Ressources_Competences", - db.Column("Ressource_code", db.String(6), db.ForeignKey("ressource.code")), - db.Column("Competence_code", db.String(3), 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")) @@ -52,9 +41,30 @@ class Competence(db.Model): situations = db.Column(db.Text(), info={'label': 'Situations'}) niveaux = db.Column(db.Text(), info={'label': 'Niveaux'}) acs = db.relationship("AC", order_by="AC.code", secondary=ACs_Competences, lazy=False, backref=db.backref("competences", lazy=False)) - #objets de formation - saes = db.relationship("SAE", secondary=SAEs_Competences, lazy=False, backref=db.backref("competences", lazy=False)) - ressources = db.relationship("Ressource", secondary=Ressources_Competences, lazy=False, backref=db.backref("competences", lazy=False)) + + def updateCoefSAE(self, saes, coef=0): + listeSAE = [coefsae.sae for coefsae in self.saes] + for sae in saes: + if sae in listeSAE: + CoefSAE.query.filter_by(sae=sae, competence=self).first().coef = coef + listeSAE.remove(sae) + else: + self.saes.append(CoefSAE(competence=self, sae=sae, coef=coef)) + for sae in listeSAE: + db.session.delete(CoefSAE.query.filter_by(sae=sae, competence=self).first()) + db.session.commit() + + def updateCoefRessource(self, ressources, coef=0): + listeRessource = [coefressource.ressource for coefressource in self.ressources] + for ressource in ressources: + if ressource in listeRessource: + CoefRessource.query.filter_by(ressource=ressource, competence=self).first().coef = coef + listeRessource.remove(ressource) + else: + self.ressources.append(CoefRessource(competence=self, ressource=ressource, coef=coef)) + for ressource in listeRessource: + db.session.delete(CoefRessource.query.filter_by(ressource=ressource, competence=self).first()) + db.session.commit() def getLabel(self): return self.code + " - " + self.nom @@ -62,12 +72,26 @@ class Competence(db.Model): def __repr__(self): return "".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) + 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")) + +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) + 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")) + class AC(db.Model): code = db.Column(db.String(6), 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)) - + def getLabel(self): return self.code + " - " + self.titre @@ -79,9 +103,7 @@ class PN(db.Model): 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'}) - - TYPES = [("1","1"),("2","2"),("3","3")] - type = db.Column(ChoiceType(TYPES)) + type = db.Column(db.String(1)) def __repr__(self): return "".format(self.code) @@ -94,11 +116,19 @@ class SAE(db.Model): heures_tp = db.Column(db.String(3), info={'label': 'Heures TP'}) projet = db.Column(db.String(3), info={'label': 'Projet'}) description = db.Column(db.Text(), info={'label': 'Description'}) - coef = db.Column(db.String(255), info={'label': 'Coef.'}) ressources = db.relationship("Ressource", order_by="Ressource.code", secondary=Ressources_SAEs, lazy=False, backref=db.backref("saes", lazy=False)) livrables = db.Column(db.Text(), info={'label': 'Livrables'}) motscles = db.Column(db.String(255), info={'label': 'Mots Clés'}) + def getCoef(self,competence): + return CoefSAE.query.filter_by(sae=self, competence=competence).first().coef + + def setCoef(self,coef,competence): + CoefSAE.query.filter_by(sae=self, competence=competence).first().coef = coef + + def getCode(self): + return self.code[3:] + def getLabel(self): return self.code + " - " + self.titre @@ -111,12 +141,20 @@ class Ressource(db.Model): semestre = db.Column(db.String(255), info={'label': 'Semestre'}) heures_formation = db.Column(db.String(3), info={'label': 'Heures Formation'}) heures_tp = db.Column(db.String(3), info={'label': 'Heures TP'}) - coef = db.Column(db.String(255), info={'label': 'Coef.'}) prerequis = db.Column(db.String(255), info={'label': 'Prerequis'}) contexte = db.Column(db.Text(), info={'label': 'Contexte'}) contenu = db.Column(db.Text(), info={'label': 'Contenu'}) motscles = db.Column(db.String(255), info={'label': 'Mots Clés'}) + def getCoef(self,competence): + return CoefRessource.query.filter_by(ressource=self, competence=competence).first().coef + + def setCoef(self,coef,competence): + CoefRessource.query.filter_by(ressource=self, competence=competence).first().coef = coef + + def getCode(self): + return self.code[1:] + def getLabel(self): return self.code + " - " + self.nom diff --git a/app/routes.py b/app/routes.py index 022d01c..e2974f0 100644 --- a/app/routes.py +++ b/app/routes.py @@ -37,24 +37,35 @@ def Semestre(num): if ressource not in queryRessource: queryRessource.append(ressource) form.ueform.__getitem__(i).saes.query=querySAE form.ueform.__getitem__(i).ressources.query=queryRessource + if not form.update.data: + for coefsae in ue.saes: + form.ueform.__getitem__(i).coef.append_entry(data={"objetformation": coefsae.sae}) + for coefressource in ue.ressources: + form.ueform.__getitem__(i).coef.append_entry(data={"objetformation": coefressource.ressource}) # Appuie sur Update if form.update.data: semestre.ues = [ue for ue in form.ues.data] + form.validate_on_submit() for i, field in enumerate(form.ueform): ue = models.Competence.query.filter_by(code=field.ue.data).first() ue.acs = field.acs.data - ue.saes = field.saes.data - ue.ressources = field.ressources.data + ue.updateCoefSAE(field.saes.data) + ue.updateCoefRessource(field.ressources.data) + for coeffield in field.coef: + codeClass, code = coeffield.objetformation.data[1:-1].split() + model = getattr(models, codeClass) + model.query.filter_by(code=code).first().setCoef(coeffield.coef.data, ue) db.session.commit() return redirect(url_for("Semestre", num=num)) - # Coche les référentiels que l'ue possède + # Remplis les fields des informations que l'ue possède for i, ue in enumerate(semestre.ues): form.ueform.__getitem__(i).acs.process_data(ue.acs) - form.ueform.__getitem__(i).saes.process_data(ue.saes) - form.ueform.__getitem__(i).ressources.process_data(ue.ressources) + form.ueform.__getitem__(i).saes.process_data([coefsae.sae for coefsae in ue.saes]) + form.ueform.__getitem__(i).ressources.process_data([coefressource.ressource for coefressource in ue.ressources]) + for field in form.ueform.__getitem__(i).coef: + field.coef.process_data(field.objetformation.data.getCoef(ue)) # Coche les ues que le semestre possède - form.ues.process_data(semestre.ues) - + form.ues.process_data(semestre.ues) return render_template("semestre.html", semestre=semestre, form=form) @app.route("/PN", defaults={"code":None}, methods=["GET","POST"]) @@ -168,7 +179,7 @@ def Competence(code): elif form.importer.data: form.importerRef() elif form.supprimer.data: - if form.supprimerRef(): return redirect(url_for("Compentence")) + if form.supprimerRef(): return redirect(url_for("Competence")) elif form.validate_on_submit() and not form.charger.data: if form.exporter.data: flash("Export du référentielCompetence: {} ".format(form.code.data)) diff --git a/app/templates/Ressource.html b/app/templates/Ressource.html index 4516d22..276ebd2 100644 --- a/app/templates/Ressource.html +++ b/app/templates/Ressource.html @@ -10,7 +10,6 @@ {{ render_field(form.semestre,"input") }} {{ render_field(form.heures_formation,"input") }} {{ render_field(form.heures_tp,"input") }} -{{ render_field(form.coef,"input") }} {{ render_list(form.acs) }}
{{ render_dropdown(form.acs) }}
{{ render_list(form.saes) }} diff --git a/app/templates/SAE.html b/app/templates/SAE.html index 75961ef..71b9709 100644 --- a/app/templates/SAE.html +++ b/app/templates/SAE.html @@ -12,7 +12,6 @@ {{ render_field(form.heures_tp,"input") }} {{ render_field(form.projet,"input") }} {{ render_field(form.description,"textarea") }} -{{ render_field(form.coef,"input") }} {{ render_list(form.acs) }}
{{ render_dropdown(form.acs) }}
{{ render_list(form.ressources) }} diff --git a/app/templates/semestre.html b/app/templates/semestre.html index afedc2b..eddd116 100644 --- a/app/templates/semestre.html +++ b/app/templates/semestre.html @@ -16,18 +16,28 @@ {{ form.ueform.__getitem__(loop.index0).ue }} {{ render_dropdown(form.ueform.__getitem__(loop.index0).acs) }} -

Objets de formation

-
    - {% for sae in competence.saes %} -
  • {{ sae.code }} - {{ sae.titre }}
  • - {% endfor %} + +

    Objets de formation

    +
      + {% for coefForm in form.ueform.__getitem__(loop.index0).coef %} +
    • +
      +
      +
      +

      + {{ coefForm.objetformation }} + {{ coefForm.objetformation.data.getLabel() }} +

      +
      +
      + {{ coefForm.coef(class="input is-pulled-right",style="width: 2em") }} +
      +
      +
      +
    • + {% endfor %}
    {{ render_dropdown(form.ueform.__getitem__(loop.index0).saes) }} - {{ render_dropdown(form.ueform.__getitem__(loop.index0).ressources) }} {% endfor %} diff --git a/migrations/versions/03ec797adcc8_.py b/migrations/versions/03ec797adcc8_.py deleted file mode 100644 index 8620327..0000000 --- a/migrations/versions/03ec797adcc8_.py +++ /dev/null @@ -1,38 +0,0 @@ -"""empty message - -Revision ID: 03ec797adcc8 -Revises: 15feabeae315 -Create Date: 2021-05-12 12:41:11.703242 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '03ec797adcc8' -down_revision = '15feabeae315' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('semestre', - sa.Column('num', sa.String(length=1), nullable=False), - sa.PrimaryKeyConstraint('num') - ) - op.create_table('Semestres_Competences', - sa.Column('Semestre_num', sa.String(length=1), nullable=True), - sa.Column('Competence_code', sa.String(length=3), nullable=True), - sa.ForeignKeyConstraint(['Competence_code'], ['competence.code'], ), - sa.ForeignKeyConstraint(['Semestre_num'], ['semestre.num'], ) - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('Semestres_Competences') - op.drop_table('semestre') - # ### end Alembic commands ### diff --git a/migrations/versions/15feabeae315_.py b/migrations/versions/7e3f15e7d9d0_.py similarity index 66% rename from migrations/versions/15feabeae315_.py rename to migrations/versions/7e3f15e7d9d0_.py index a9117ba..fa12c0d 100644 --- a/migrations/versions/15feabeae315_.py +++ b/migrations/versions/7e3f15e7d9d0_.py @@ -1,8 +1,8 @@ """empty message -Revision ID: 15feabeae315 +Revision ID: 7e3f15e7d9d0 Revises: -Create Date: 2021-05-07 16:45:01.928258 +Create Date: 2021-06-03 18:25:50.167616 """ from alembic import op @@ -10,7 +10,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '15feabeae315' +revision = '7e3f15e7d9d0' down_revision = None branch_labels = None depends_on = None @@ -39,7 +39,6 @@ def upgrade(): sa.Column('heures_tp', sa.String(length=3), nullable=True), sa.Column('projet', sa.String(length=3), nullable=True), sa.Column('description', sa.Text(), nullable=True), - sa.Column('coef', sa.String(length=255), nullable=True), sa.Column('livrables', sa.Text(), nullable=True), sa.Column('motscles', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('code') @@ -60,13 +59,22 @@ def upgrade(): sa.Column('semestre', sa.String(length=255), nullable=True), sa.Column('heures_formation', sa.String(length=3), nullable=True), sa.Column('heures_tp', sa.String(length=3), nullable=True), - sa.Column('coef', sa.String(length=255), nullable=True), sa.Column('prerequis', sa.String(length=255), nullable=True), sa.Column('contexte', sa.Text(), nullable=True), sa.Column('contenu', sa.Text(), nullable=True), sa.Column('motscles', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('code') ) + op.create_table('semestre', + sa.Column('num', sa.String(length=1), nullable=False), + sa.PrimaryKeyConstraint('num') + ) + op.create_table('ACs_Competences', + sa.Column('AC_code', sa.String(length=6), nullable=True), + sa.Column('Competence_code', sa.String(length=3), nullable=True), + sa.ForeignKeyConstraint(['AC_code'], ['AC.code'], ), + sa.ForeignKeyConstraint(['Competence_code'], ['competence.code'], ) + ) op.create_table('Ressources_ACs', sa.Column('Ressource_code', sa.String(length=4), nullable=True), sa.Column('AC_code', sa.String(length=6), nullable=True), @@ -85,14 +93,41 @@ def upgrade(): sa.ForeignKeyConstraint(['AC_code'], ['AC.code'], ), sa.ForeignKeyConstraint(['SAE_code'], ['SAE.code'], ) ) + op.create_table('Semestres_Competences', + sa.Column('Semestre_num', sa.String(length=1), nullable=True), + sa.Column('Competence_code', sa.String(length=3), nullable=True), + sa.ForeignKeyConstraint(['Competence_code'], ['competence.code'], ), + sa.ForeignKeyConstraint(['Semestre_num'], ['semestre.num'], ) + ) + op.create_table('coefSAE', + sa.Column('competence_code', sa.String(length=3), nullable=False), + sa.Column('sae_code', sa.String(length=6), nullable=False), + sa.Column('coef', sa.String(length=2), nullable=True), + sa.ForeignKeyConstraint(['competence_code'], ['competence.code'], ), + sa.ForeignKeyConstraint(['sae_code'], ['SAE.code'], ), + sa.PrimaryKeyConstraint('competence_code', 'sae_code') + ) + op.create_table('coef_ressource', + sa.Column('competence_code', sa.String(length=3), nullable=False), + sa.Column('ressource_code', sa.String(length=4), nullable=False), + sa.Column('coef', sa.String(length=2), nullable=True), + sa.ForeignKeyConstraint(['competence_code'], ['competence.code'], ), + sa.ForeignKeyConstraint(['ressource_code'], ['ressource.code'], ), + sa.PrimaryKeyConstraint('competence_code', 'ressource_code') + ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('coef_ressource') + op.drop_table('coefSAE') + op.drop_table('Semestres_Competences') op.drop_table('SAEs_ACs') op.drop_table('Ressources_SAEs') op.drop_table('Ressources_ACs') + op.drop_table('ACs_Competences') + op.drop_table('semestre') op.drop_table('ressource') op.drop_table('competence') op.drop_table('SAE') diff --git a/migrations/versions/8b0862eb0856_.py b/migrations/versions/8b0862eb0856_.py deleted file mode 100644 index 7a9682f..0000000 --- a/migrations/versions/8b0862eb0856_.py +++ /dev/null @@ -1,40 +0,0 @@ -"""empty message - -Revision ID: 8b0862eb0856 -Revises: cff96c022884 -Create Date: 2021-06-01 18:50:16.604312 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '8b0862eb0856' -down_revision = 'cff96c022884' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('Ressources_Competences', - sa.Column('Ressource_code', sa.String(length=6), nullable=True), - sa.Column('Competence_code', sa.String(length=3), nullable=True), - sa.ForeignKeyConstraint(['Competence_code'], ['competence.code'], ), - sa.ForeignKeyConstraint(['Ressource_code'], ['ressource.code'], ) - ) - op.create_table('SAEs_Competences', - sa.Column('SAE_code', sa.String(length=6), nullable=True), - sa.Column('Competence_code', sa.String(length=3), nullable=True), - sa.ForeignKeyConstraint(['Competence_code'], ['competence.code'], ), - sa.ForeignKeyConstraint(['SAE_code'], ['SAE.code'], ) - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('SAEs_Competences') - op.drop_table('Ressources_Competences') - # ### end Alembic commands ### diff --git a/migrations/versions/cff96c022884_.py b/migrations/versions/cff96c022884_.py deleted file mode 100644 index ee10011..0000000 --- a/migrations/versions/cff96c022884_.py +++ /dev/null @@ -1,33 +0,0 @@ -"""empty message - -Revision ID: cff96c022884 -Revises: 03ec797adcc8 -Create Date: 2021-05-13 15:30:50.203249 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'cff96c022884' -down_revision = '03ec797adcc8' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('ACs_Competences', - sa.Column('AC_code', sa.String(length=6), nullable=True), - sa.Column('Competence_code', sa.String(length=3), nullable=True), - sa.ForeignKeyConstraint(['AC_code'], ['AC.code'], ), - sa.ForeignKeyConstraint(['Competence_code'], ['competence.code'], ) - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('ACs_Competences') - # ### end Alembic commands ###