forked from ScoDoc/ScoDoc
rendre expirée une offre
This commit is contained in:
parent
4949fbda6b
commit
626dc0157a
@ -158,9 +158,7 @@ class OffreCreationForm(FlaskForm):
|
|||||||
)
|
)
|
||||||
duree = _build_string_field("Durée (*)")
|
duree = _build_string_field("Durée (*)")
|
||||||
depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
||||||
expiration_date = DateField(
|
expiration_date = DateField("Date expiration", validators=[Optional()])
|
||||||
"Date expiration (*)", validators=[DataRequired(message=CHAMP_REQUIS)]
|
|
||||||
)
|
|
||||||
submit = SubmitField("Envoyer", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Envoyer", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -186,9 +184,7 @@ class OffreModificationForm(FlaskForm):
|
|||||||
)
|
)
|
||||||
duree = _build_string_field("Durée (*)")
|
duree = _build_string_field("Durée (*)")
|
||||||
depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
||||||
expiration_date = DateField(
|
expiration_date = DateField("Date expiration", validators=[Optional()])
|
||||||
"Date expiration (*)", validators=[DataRequired(message=CHAMP_REQUIS)]
|
|
||||||
)
|
|
||||||
submit = SubmitField("Modifier", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Modifier", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -9,7 +9,7 @@ class Entreprise(db.Model):
|
|||||||
adresse = db.Column(db.Text)
|
adresse = db.Column(db.Text)
|
||||||
codepostal = db.Column(db.Text)
|
codepostal = db.Column(db.Text)
|
||||||
ville = db.Column(db.Text)
|
ville = db.Column(db.Text)
|
||||||
pays = db.Column(db.Text)
|
pays = db.Column(db.Text, default="FRANCE")
|
||||||
visible = db.Column(db.Boolean, default=False)
|
visible = db.Column(db.Boolean, default=False)
|
||||||
contacts = db.relationship(
|
contacts = db.relationship(
|
||||||
"EntrepriseContact",
|
"EntrepriseContact",
|
||||||
@ -36,7 +36,7 @@ class Entreprise(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
class EntrepriseContact(db.Model):
|
class EntrepriseContact(db.Model):
|
||||||
__tablename__ = "are_entreprise_contact"
|
__tablename__ = "are_contacts"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
entreprise_id = db.Column(
|
entreprise_id = db.Column(
|
||||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||||
@ -62,7 +62,7 @@ class EntrepriseContact(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
class EntrepriseOffre(db.Model):
|
class EntrepriseOffre(db.Model):
|
||||||
__tablename__ = "are_entreprise_offre"
|
__tablename__ = "are_offres"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
entreprise_id = db.Column(
|
entreprise_id = db.Column(
|
||||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||||
@ -74,6 +74,7 @@ class EntrepriseOffre(db.Model):
|
|||||||
missions = db.Column(db.Text)
|
missions = db.Column(db.Text)
|
||||||
duree = db.Column(db.Text)
|
duree = db.Column(db.Text)
|
||||||
expiration_date = db.Column(db.Date)
|
expiration_date = db.Column(db.Date)
|
||||||
|
expired = db.Column(db.Boolean, default=False)
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {
|
return {
|
||||||
@ -86,7 +87,7 @@ class EntrepriseOffre(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
class EntrepriseLog(db.Model):
|
class EntrepriseLog(db.Model):
|
||||||
__tablename__ = "are_entreprise_log"
|
__tablename__ = "are_logs"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
date = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
date = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
||||||
authenticated_user = db.Column(db.Text)
|
authenticated_user = db.Column(db.Text)
|
||||||
@ -95,7 +96,7 @@ class EntrepriseLog(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
class EntrepriseEtudiant(db.Model):
|
class EntrepriseEtudiant(db.Model):
|
||||||
__tablename__ = "are_entreprise_etudiant"
|
__tablename__ = "are_etudiants"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
entreprise_id = db.Column(
|
entreprise_id = db.Column(
|
||||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||||
@ -109,35 +110,29 @@ class EntrepriseEtudiant(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
class EntrepriseEnvoiOffre(db.Model):
|
class EntrepriseEnvoiOffre(db.Model):
|
||||||
__tablename__ = "are_entreprise_envoi_offre"
|
__tablename__ = "are_envoi_offre"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
sender_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="cascade"))
|
sender_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="cascade"))
|
||||||
receiver_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="cascade"))
|
receiver_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="cascade"))
|
||||||
offre_id = db.Column(
|
offre_id = db.Column(db.Integer, db.ForeignKey("are_offres.id", ondelete="cascade"))
|
||||||
db.Integer, db.ForeignKey("are_entreprise_offre.id", ondelete="cascade")
|
|
||||||
)
|
|
||||||
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
||||||
|
|
||||||
|
|
||||||
class EntrepriseEnvoiOffreEtudiant(db.Model):
|
class EntrepriseEnvoiOffreEtudiant(db.Model):
|
||||||
__tablename__ = "are_entreprise_envoi_offre_etudiant"
|
__tablename__ = "are_envoi_offre_etudiant"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
sender_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="cascade"))
|
sender_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="cascade"))
|
||||||
receiver_id = db.Column(
|
receiver_id = db.Column(
|
||||||
db.Integer, db.ForeignKey("identite.id", ondelete="cascade")
|
db.Integer, db.ForeignKey("identite.id", ondelete="cascade")
|
||||||
)
|
)
|
||||||
offre_id = db.Column(
|
offre_id = db.Column(db.Integer, db.ForeignKey("are_offres.id", ondelete="cascade"))
|
||||||
db.Integer, db.ForeignKey("are_entreprise_offre.id", ondelete="cascade")
|
|
||||||
)
|
|
||||||
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
||||||
|
|
||||||
|
|
||||||
class EntrepriseOffreDepartement(db.Model):
|
class EntrepriseOffreDepartement(db.Model):
|
||||||
__tablename__ = "are_entreprise_offre_departement"
|
__tablename__ = "are_offre_departement"
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
offre_id = db.Column(
|
offre_id = db.Column(db.Integer, db.ForeignKey("are_offres.id", ondelete="cascade"))
|
||||||
db.Integer, db.ForeignKey("are_entreprise_offre.id", ondelete="cascade")
|
|
||||||
)
|
|
||||||
dept_id = db.Column(db.Integer, db.ForeignKey("departement.id", ondelete="cascade"))
|
dept_id = db.Column(db.Integer, db.ForeignKey("departement.id", ondelete="cascade"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +131,13 @@ def fiche_entreprise(id):
|
|||||||
offres_with_files = []
|
offres_with_files = []
|
||||||
depts = are.get_depts()
|
depts = are.get_depts()
|
||||||
for offre in entreprise.offres:
|
for offre in entreprise.offres:
|
||||||
if date.today() < offre.expiration_date:
|
if not offre.expired and (
|
||||||
|
offre.expiration_date is None
|
||||||
|
or (
|
||||||
|
offre.expiration_date is not None
|
||||||
|
and date.today() < offre.expiration_date
|
||||||
|
)
|
||||||
|
):
|
||||||
offre_with_files = are.get_offre_files_and_depts(offre, depts)
|
offre_with_files = are.get_offre_files_and_depts(offre, depts)
|
||||||
if offre_with_files is not None:
|
if offre_with_files is not None:
|
||||||
offres_with_files.append(offre_with_files)
|
offres_with_files.append(offre_with_files)
|
||||||
@ -249,7 +255,9 @@ def offres_expirees(id):
|
|||||||
offres_expirees_with_files = []
|
offres_expirees_with_files = []
|
||||||
depts = are.get_depts()
|
depts = are.get_depts()
|
||||||
for offre in entreprise.offres:
|
for offre in entreprise.offres:
|
||||||
if date.today() > offre.expiration_date:
|
if offre.expired or (
|
||||||
|
offre.expiration_date is not None and date.today() > offre.expiration_date
|
||||||
|
):
|
||||||
offre_expiree_with_files = are.get_offre_files_and_depts(offre, depts)
|
offre_expiree_with_files = are.get_offre_files_and_depts(offre, depts)
|
||||||
if offre_expiree_with_files is not None:
|
if offre_expiree_with_files is not None:
|
||||||
offres_expirees_with_files.append(offre_expiree_with_files)
|
offres_expirees_with_files.append(offre_expiree_with_files)
|
||||||
@ -624,6 +632,17 @@ def delete_offre_recue(id):
|
|||||||
return redirect(url_for("entreprises.offres_recues"))
|
return redirect(url_for("entreprises.offres_recues"))
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/expired/<int:id>", methods=["GET", "POST"])
|
||||||
|
@permission_required(Permission.RelationsEntreprisesChange)
|
||||||
|
def expired(id):
|
||||||
|
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
||||||
|
description=f"offre {id} inconnue"
|
||||||
|
)
|
||||||
|
offre.expired = not offre.expired
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for("entreprises.fiche_entreprise", id=offre.entreprise_id))
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/add_contact/<int:id>", methods=["GET", "POST"])
|
@bp.route("/add_contact/<int:id>", methods=["GET", "POST"])
|
||||||
@permission_required(Permission.RelationsEntreprisesChange)
|
@permission_required(Permission.RelationsEntreprisesChange)
|
||||||
def add_contact(id):
|
def add_contact(id):
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesSend, None) %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesSend, None) %}
|
||||||
<a class="btn btn-primary" href="{{ url_for('entreprises.envoyer_offre', id=offre[0].id) }}">Envoyer l'offre</a>
|
<a class="btn btn-primary" href="{{ url_for('entreprises.envoyer_offre', id=offre[0].id) }}">Envoyer l'offre</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||||
|
{% if not offre[0].expired %}
|
||||||
|
<a class="btn btn-danger" href="{{ url_for('entreprises.expired', id=offre[0].id) }}">Rendre expirée</a>
|
||||||
|
{% else %}
|
||||||
|
<a class="btn btn-success" href="{{ url_for('entreprises.expired', id=offre[0].id) }}">Rendre non expirée</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
@ -1,8 +1,8 @@
|
|||||||
"""tables module gestion relations entreprises
|
"""tables module gestion relations entreprises
|
||||||
|
|
||||||
Revision ID: 717a8dfe2915
|
Revision ID: af05f03b81be
|
||||||
Revises: b9aadc10227f
|
Revises: b9aadc10227f
|
||||||
Create Date: 2022-02-22 20:18:57.171246
|
Create Date: 2022-03-01 17:12:32.927643
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
|||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "717a8dfe2915"
|
revision = "af05f03b81be"
|
||||||
down_revision = "b9aadc10227f"
|
down_revision = "b9aadc10227f"
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
@ -18,20 +18,6 @@ depends_on = None
|
|||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.create_table(
|
|
||||||
"are_entreprise_log",
|
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
|
||||||
sa.Column(
|
|
||||||
"date",
|
|
||||||
sa.DateTime(timezone=True),
|
|
||||||
server_default=sa.text("now()"),
|
|
||||||
nullable=True,
|
|
||||||
),
|
|
||||||
sa.Column("authenticated_user", sa.Text(), nullable=True),
|
|
||||||
sa.Column("object", sa.Integer(), nullable=True),
|
|
||||||
sa.Column("text", sa.Text(), nullable=True),
|
|
||||||
sa.PrimaryKeyConstraint("id"),
|
|
||||||
)
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprises",
|
"are_entreprises",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
@ -44,6 +30,20 @@ def upgrade():
|
|||||||
sa.Column("visible", sa.Boolean(), nullable=True),
|
sa.Column("visible", sa.Boolean(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
|
op.create_table(
|
||||||
|
"are_logs",
|
||||||
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
|
sa.Column(
|
||||||
|
"date",
|
||||||
|
sa.DateTime(timezone=True),
|
||||||
|
server_default=sa.text("now()"),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
sa.Column("authenticated_user", sa.Text(), nullable=True),
|
||||||
|
sa.Column("object", sa.Integer(), nullable=True),
|
||||||
|
sa.Column("text", sa.Text(), nullable=True),
|
||||||
|
sa.PrimaryKeyConstraint("id"),
|
||||||
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_preferences",
|
"are_preferences",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
@ -52,7 +52,7 @@ def upgrade():
|
|||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_contact",
|
"are_contacts",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
||||||
sa.Column("nom", sa.Text(), nullable=True),
|
sa.Column("nom", sa.Text(), nullable=True),
|
||||||
@ -67,7 +67,7 @@ def upgrade():
|
|||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_etudiant",
|
"are_etudiants",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
||||||
sa.Column("etudid", sa.Integer(), nullable=True),
|
sa.Column("etudid", sa.Integer(), nullable=True),
|
||||||
@ -82,7 +82,7 @@ def upgrade():
|
|||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_offre",
|
"are_offres",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
||||||
sa.Column(
|
sa.Column(
|
||||||
@ -97,13 +97,14 @@ def upgrade():
|
|||||||
sa.Column("missions", sa.Text(), nullable=True),
|
sa.Column("missions", sa.Text(), nullable=True),
|
||||||
sa.Column("duree", sa.Text(), nullable=True),
|
sa.Column("duree", sa.Text(), nullable=True),
|
||||||
sa.Column("expiration_date", sa.Date(), nullable=True),
|
sa.Column("expiration_date", sa.Date(), nullable=True),
|
||||||
|
sa.Column("expired", sa.Boolean(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["entreprise_id"], ["are_entreprises.id"], ondelete="cascade"
|
["entreprise_id"], ["are_entreprises.id"], ondelete="cascade"
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_envoi_offre",
|
"are_envoi_offre",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
sa.Column("sender_id", sa.Integer(), nullable=True),
|
sa.Column("sender_id", sa.Integer(), nullable=True),
|
||||||
sa.Column("receiver_id", sa.Integer(), nullable=True),
|
sa.Column("receiver_id", sa.Integer(), nullable=True),
|
||||||
@ -114,15 +115,13 @@ def upgrade():
|
|||||||
server_default=sa.text("now()"),
|
server_default=sa.text("now()"),
|
||||||
nullable=True,
|
nullable=True,
|
||||||
),
|
),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(["offre_id"], ["are_offres.id"], ondelete="cascade"),
|
||||||
["offre_id"], ["are_entreprise_offre.id"], ondelete="cascade"
|
|
||||||
),
|
|
||||||
sa.ForeignKeyConstraint(["receiver_id"], ["user.id"], ondelete="cascade"),
|
sa.ForeignKeyConstraint(["receiver_id"], ["user.id"], ondelete="cascade"),
|
||||||
sa.ForeignKeyConstraint(["sender_id"], ["user.id"], ondelete="cascade"),
|
sa.ForeignKeyConstraint(["sender_id"], ["user.id"], ondelete="cascade"),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_envoi_offre_etudiant",
|
"are_envoi_offre_etudiant",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
sa.Column("sender_id", sa.Integer(), nullable=True),
|
sa.Column("sender_id", sa.Integer(), nullable=True),
|
||||||
sa.Column("receiver_id", sa.Integer(), nullable=True),
|
sa.Column("receiver_id", sa.Integer(), nullable=True),
|
||||||
@ -133,44 +132,29 @@ def upgrade():
|
|||||||
server_default=sa.text("now()"),
|
server_default=sa.text("now()"),
|
||||||
nullable=True,
|
nullable=True,
|
||||||
),
|
),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(["offre_id"], ["are_offres.id"], ondelete="cascade"),
|
||||||
["offre_id"], ["are_entreprise_offre.id"], ondelete="cascade"
|
|
||||||
),
|
|
||||||
sa.ForeignKeyConstraint(["receiver_id"], ["identite.id"], ondelete="cascade"),
|
sa.ForeignKeyConstraint(["receiver_id"], ["identite.id"], ondelete="cascade"),
|
||||||
sa.ForeignKeyConstraint(["sender_id"], ["user.id"], ondelete="cascade"),
|
sa.ForeignKeyConstraint(["sender_id"], ["user.id"], ondelete="cascade"),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_offre_departement",
|
"are_offre_departement",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
sa.Column("offre_id", sa.Integer(), nullable=True),
|
sa.Column("offre_id", sa.Integer(), nullable=True),
|
||||||
sa.Column("dept_id", sa.Integer(), nullable=True),
|
sa.Column("dept_id", sa.Integer(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(["dept_id"], ["departement.id"], ondelete="cascade"),
|
sa.ForeignKeyConstraint(["dept_id"], ["departement.id"], ondelete="cascade"),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(["offre_id"], ["are_offres.id"], ondelete="cascade"),
|
||||||
["offre_id"], ["are_entreprise_offre.id"], ondelete="cascade"
|
|
||||||
),
|
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
op.drop_table("entreprise_contact")
|
op.drop_table("entreprise_contact")
|
||||||
op.drop_table("entreprise_correspondant")
|
op.drop_table("entreprise_correspondant")
|
||||||
op.drop_index("ix_entreprises_dept_id", table_name="entreprises")
|
op.drop_index("ix_entreprises_dept_id", table_name="entreprises")
|
||||||
op.drop_table("entreprises")
|
op.drop_table("entreprises")
|
||||||
op.drop_index("ix_apc_competence_id_orebut", table_name="apc_competence")
|
|
||||||
op.create_index(
|
|
||||||
op.f("ix_apc_competence_id_orebut"),
|
|
||||||
"apc_competence",
|
|
||||||
["id_orebut"],
|
|
||||||
unique=False,
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_index(op.f("ix_apc_competence_id_orebut"), table_name="apc_competence")
|
|
||||||
op.create_index(
|
|
||||||
"ix_apc_competence_id_orebut", "apc_competence", ["id_orebut"], unique=False
|
|
||||||
)
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"entreprises",
|
"entreprises",
|
||||||
sa.Column(
|
sa.Column(
|
||||||
@ -258,13 +242,13 @@ def downgrade():
|
|||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("id", name="entreprise_contact_pkey"),
|
sa.PrimaryKeyConstraint("id", name="entreprise_contact_pkey"),
|
||||||
)
|
)
|
||||||
op.drop_table("are_entreprise_offre_departement")
|
op.drop_table("are_offre_departement")
|
||||||
op.drop_table("are_entreprise_envoi_offre_etudiant")
|
op.drop_table("are_envoi_offre_etudiant")
|
||||||
op.drop_table("are_entreprise_envoi_offre")
|
op.drop_table("are_envoi_offre")
|
||||||
op.drop_table("are_entreprise_offre")
|
op.drop_table("are_offres")
|
||||||
op.drop_table("are_entreprise_etudiant")
|
op.drop_table("are_etudiants")
|
||||||
op.drop_table("are_entreprise_contact")
|
op.drop_table("are_contacts")
|
||||||
op.drop_table("are_preferences")
|
op.drop_table("are_preferences")
|
||||||
|
op.drop_table("are_logs")
|
||||||
op.drop_table("are_entreprises")
|
op.drop_table("are_entreprises")
|
||||||
op.drop_table("are_entreprise_log")
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user