forked from ScoDoc/DocScoDoc
update migration version
This commit is contained in:
parent
065bcfe1a0
commit
4d2d2f20fb
@ -34,14 +34,13 @@ from app.entreprises.models import (
|
||||
)
|
||||
from app.models import Identite
|
||||
from app.auth.models import User
|
||||
from app.scodoc.sco_find_etud import search_etud_by_name
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc import sco_etud, sco_excel
|
||||
import app.scodoc.sco_utils as scu
|
||||
|
||||
from app import db
|
||||
from sqlalchemy import text
|
||||
from werkzeug.utils import secure_filename, send_from_directory
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
|
||||
@bp.route("/", methods=["GET"])
|
||||
|
@ -10,136 +10,246 @@ import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f3b62d64efa3'
|
||||
down_revision = '91be8a06d423'
|
||||
revision = "f3b62d64efa3"
|
||||
down_revision = "91be8a06d423"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('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(
|
||||
"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('entreprise_etudiant',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('entreprise_id', sa.Integer(), nullable=True),
|
||||
sa.Column('etudid', sa.Integer(), nullable=True),
|
||||
sa.Column('type_offre', sa.Text(), nullable=True),
|
||||
sa.Column('date_debut', sa.Date(), nullable=True),
|
||||
sa.Column('date_fin', sa.Date(), nullable=True),
|
||||
sa.Column('formation_text', sa.Text(), nullable=True),
|
||||
sa.Column('formation_scodoc', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['entreprise_id'], ['entreprises.id'], ondelete='cascade'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
op.create_table(
|
||||
"entreprise_etudiant",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
||||
sa.Column("etudid", sa.Integer(), nullable=True),
|
||||
sa.Column("type_offre", sa.Text(), nullable=True),
|
||||
sa.Column("date_debut", sa.Date(), nullable=True),
|
||||
sa.Column("date_fin", sa.Date(), nullable=True),
|
||||
sa.Column("formation_text", sa.Text(), nullable=True),
|
||||
sa.Column("formation_scodoc", sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["entreprise_id"], ["entreprises.id"], ondelete="cascade"
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
op.create_table('entreprise_offre',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('entreprise_id', sa.Integer(), nullable=True),
|
||||
sa.Column('date_ajout', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('intitule', sa.Text(), nullable=True),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('type_offre', sa.Text(), nullable=True),
|
||||
sa.Column('missions', sa.Text(), nullable=True),
|
||||
sa.Column('duree', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['entreprise_id'], ['entreprises.id'], ondelete='cascade'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
op.create_table(
|
||||
"entreprise_offre",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
||||
sa.Column(
|
||||
"date_ajout",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column("intitule", sa.Text(), nullable=True),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("type_offre", sa.Text(), nullable=True),
|
||||
sa.Column("missions", sa.Text(), nullable=True),
|
||||
sa.Column("duree", sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["entreprise_id"], ["entreprises.id"], ondelete="cascade"
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
op.create_table('entreprise_envoi_offre',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('offre_id', sa.Integer(), nullable=True),
|
||||
sa.Column('date_envoi', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.ForeignKeyConstraint(['offre_id'], ['entreprise_offre.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
op.create_table(
|
||||
"entreprise_envoi_offre",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("sender_id", sa.Integer(), nullable=True),
|
||||
sa.Column("receiver_id", sa.Integer(), nullable=True),
|
||||
sa.Column("offre_id", sa.Integer(), nullable=True),
|
||||
sa.Column(
|
||||
"date_envoi",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["offre_id"],
|
||||
["entreprise_offre.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["sender_id"],
|
||||
["user.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["receiver_id"],
|
||||
["user.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
op.drop_constraint('entreprise_contact_entreprise_corresp_id_fkey', 'entreprise_contact', type_='foreignkey')
|
||||
op.drop_table('entreprise_correspondant')
|
||||
op.add_column('entreprise_contact', sa.Column('nom', sa.Text(), nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('prenom', sa.Text(), nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('telephone', sa.Text(), nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('mail', sa.Text(), nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('poste', sa.Text(), nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('service', sa.Text(), nullable=True))
|
||||
op.drop_column('entreprise_contact', 'description')
|
||||
op.drop_column('entreprise_contact', 'enseignant')
|
||||
op.drop_column('entreprise_contact', 'date')
|
||||
op.drop_column('entreprise_contact', 'type_contact')
|
||||
op.drop_column('entreprise_contact', 'etudid')
|
||||
op.drop_column('entreprise_contact', 'entreprise_corresp_id')
|
||||
op.drop_constraint(
|
||||
"entreprise_contact_entreprise_corresp_id_fkey",
|
||||
"entreprise_contact",
|
||||
type_="foreignkey",
|
||||
)
|
||||
op.drop_table("entreprise_correspondant")
|
||||
op.add_column("entreprise_contact", sa.Column("nom", sa.Text(), nullable=True))
|
||||
op.add_column("entreprise_contact", sa.Column("prenom", sa.Text(), nullable=True))
|
||||
op.add_column(
|
||||
"entreprise_contact", sa.Column("telephone", sa.Text(), nullable=True)
|
||||
)
|
||||
op.add_column("entreprise_contact", sa.Column("mail", sa.Text(), nullable=True))
|
||||
op.add_column("entreprise_contact", sa.Column("poste", sa.Text(), nullable=True))
|
||||
op.add_column("entreprise_contact", sa.Column("service", sa.Text(), nullable=True))
|
||||
op.drop_column("entreprise_contact", "description")
|
||||
op.drop_column("entreprise_contact", "enseignant")
|
||||
op.drop_column("entreprise_contact", "date")
|
||||
op.drop_column("entreprise_contact", "type_contact")
|
||||
op.drop_column("entreprise_contact", "etudid")
|
||||
op.drop_column("entreprise_contact", "entreprise_corresp_id")
|
||||
|
||||
op.add_column('entreprises', sa.Column('siret', sa.Text(), nullable=True))
|
||||
op.drop_index('ix_entreprises_dept_id', table_name='entreprises')
|
||||
op.drop_constraint('entreprises_dept_id_fkey', 'entreprises', type_='foreignkey')
|
||||
op.drop_column('entreprises', 'qualite_relation')
|
||||
op.drop_column('entreprises', 'note')
|
||||
op.drop_column('entreprises', 'contact_origine')
|
||||
op.drop_column('entreprises', 'plus10salaries')
|
||||
op.drop_column('entreprises', 'privee')
|
||||
op.drop_column('entreprises', 'secteur')
|
||||
op.drop_column('entreprises', 'date_creation')
|
||||
op.drop_column('entreprises', 'dept_id')
|
||||
op.drop_column('entreprises', 'localisation')
|
||||
op.add_column("entreprises", sa.Column("siret", sa.Text(), nullable=True))
|
||||
op.drop_index("ix_entreprises_dept_id", table_name="entreprises")
|
||||
op.drop_constraint("entreprises_dept_id_fkey", "entreprises", type_="foreignkey")
|
||||
op.drop_column("entreprises", "qualite_relation")
|
||||
op.drop_column("entreprises", "note")
|
||||
op.drop_column("entreprises", "contact_origine")
|
||||
op.drop_column("entreprises", "plus10salaries")
|
||||
op.drop_column("entreprises", "privee")
|
||||
op.drop_column("entreprises", "secteur")
|
||||
op.drop_column("entreprises", "date_creation")
|
||||
op.drop_column("entreprises", "dept_id")
|
||||
op.drop_column("entreprises", "localisation")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('entreprises', sa.Column('localisation', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('dept_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('date_creation', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('secteur', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('privee', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('plus10salaries', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('contact_origine', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('note', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprises', sa.Column('qualite_relation', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.create_foreign_key('entreprises_dept_id_fkey', 'entreprises', 'departement', ['dept_id'], ['id'])
|
||||
op.create_index('ix_entreprises_dept_id', 'entreprises', ['dept_id'], unique=False)
|
||||
op.drop_column('entreprises', 'siret')
|
||||
op.add_column('entreprise_contact', sa.Column('entreprise_corresp_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('etudid', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('type_contact', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('enseignant', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.add_column('entreprise_contact', sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True))
|
||||
op.create_table('entreprise_correspondant',
|
||||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
||||
sa.Column('entreprise_id', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('nom', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('prenom', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('civilite', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('fonction', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('phone1', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('phone2', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('mobile', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('mail1', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('mail2', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('fax', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('note', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['entreprise_id'], ['entreprises.id'], name='entreprise_correspondant_entreprise_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='entreprise_correspondant_pkey')
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("localisation", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.create_foreign_key('entreprise_contact_entreprise_corresp_id_fkey', 'entreprise_contact', 'entreprise_correspondant', ['entreprise_corresp_id'], ['id'])
|
||||
op.drop_column('entreprise_contact', 'service')
|
||||
op.drop_column('entreprise_contact', 'poste')
|
||||
op.drop_column('entreprise_contact', 'mail')
|
||||
op.drop_column('entreprise_contact', 'telephone')
|
||||
op.drop_column('entreprise_contact', 'prenom')
|
||||
op.drop_column('entreprise_contact', 'nom')
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("dept_id", sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column(
|
||||
"date_creation",
|
||||
postgresql.TIMESTAMP(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
autoincrement=False,
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("secteur", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("privee", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("plus10salaries", sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("contact_origine", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises", sa.Column("note", sa.TEXT(), autoincrement=False, nullable=True)
|
||||
)
|
||||
op.add_column(
|
||||
"entreprises",
|
||||
sa.Column("qualite_relation", sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.create_foreign_key(
|
||||
"entreprises_dept_id_fkey", "entreprises", "departement", ["dept_id"], ["id"]
|
||||
)
|
||||
op.create_index("ix_entreprises_dept_id", "entreprises", ["dept_id"], unique=False)
|
||||
op.drop_column("entreprises", "siret")
|
||||
op.add_column(
|
||||
"entreprise_contact",
|
||||
sa.Column(
|
||||
"entreprise_corresp_id", sa.INTEGER(), autoincrement=False, nullable=True
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprise_contact",
|
||||
sa.Column("etudid", sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprise_contact",
|
||||
sa.Column("type_contact", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprise_contact",
|
||||
sa.Column(
|
||||
"date",
|
||||
postgresql.TIMESTAMP(timezone=True),
|
||||
autoincrement=False,
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprise_contact",
|
||||
sa.Column("enseignant", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"entreprise_contact",
|
||||
sa.Column("description", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.create_table(
|
||||
"entreprise_correspondant",
|
||||
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
|
||||
sa.Column("entreprise_id", sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("prenom", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("civilite", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("fonction", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("phone1", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("phone2", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("mobile", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("mail1", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("mail2", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("fax", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("note", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["entreprise_id"],
|
||||
["entreprises.id"],
|
||||
name="entreprise_correspondant_entreprise_id_fkey",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name="entreprise_correspondant_pkey"),
|
||||
)
|
||||
op.create_foreign_key(
|
||||
"entreprise_contact_entreprise_corresp_id_fkey",
|
||||
"entreprise_contact",
|
||||
"entreprise_correspondant",
|
||||
["entreprise_corresp_id"],
|
||||
["id"],
|
||||
)
|
||||
op.drop_column("entreprise_contact", "service")
|
||||
op.drop_column("entreprise_contact", "poste")
|
||||
op.drop_column("entreprise_contact", "mail")
|
||||
op.drop_column("entreprise_contact", "telephone")
|
||||
op.drop_column("entreprise_contact", "prenom")
|
||||
op.drop_column("entreprise_contact", "nom")
|
||||
|
||||
op.drop_table('entreprise_envoi_offre')
|
||||
op.drop_table('entreprise_offre')
|
||||
op.drop_table('entreprise_etudiant')
|
||||
op.drop_table('entreprise_log')
|
||||
op.drop_table("entreprise_envoi_offre")
|
||||
op.drop_table("entreprise_offre")
|
||||
op.drop_table("entreprise_etudiant")
|
||||
op.drop_table("entreprise_log")
|
||||
# ### end Alembic commands ###
|
||||
|
Loading…
Reference in New Issue
Block a user