From f4514ad4ead42f6cffd49c81f7524325c60cf060 Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Tue, 12 Jul 2022 10:32:23 +0200 Subject: [PATCH] ajout siret provisoire --- app/entreprises/models.py | 3 ++- ...12282_suppression_colonne_are_correspondants_.py} | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) rename migrations/versions/{ec4f4f4ae9db_suppression_colonne_are_correspondants.py => bd358f412282_suppression_colonne_are_correspondants_.py} (63%) diff --git a/app/entreprises/models.py b/app/entreprises/models.py index b168a94f9..5795d76dd 100644 --- a/app/entreprises/models.py +++ b/app/entreprises/models.py @@ -4,7 +4,8 @@ from app import db class Entreprise(db.Model): __tablename__ = "are_entreprises" id = db.Column(db.Integer, primary_key=True) - siret = db.Column(db.Text) + siret = db.Column(db.Text, index=True) + siret_provisoire = db.Column(db.Boolean, default=False) nom = db.Column(db.Text) adresse = db.Column(db.Text) codepostal = db.Column(db.Text) diff --git a/migrations/versions/ec4f4f4ae9db_suppression_colonne_are_correspondants.py b/migrations/versions/bd358f412282_suppression_colonne_are_correspondants_.py similarity index 63% rename from migrations/versions/ec4f4f4ae9db_suppression_colonne_are_correspondants.py rename to migrations/versions/bd358f412282_suppression_colonne_are_correspondants_.py index a092ab524..ee3d6f826 100644 --- a/migrations/versions/ec4f4f4ae9db_suppression_colonne_are_correspondants.py +++ b/migrations/versions/bd358f412282_suppression_colonne_are_correspondants_.py @@ -1,8 +1,8 @@ -"""suppression colonne are_correspondants +"""suppression colonne are_correspondants, ajout siret provisoire -Revision ID: ec4f4f4ae9db +Revision ID: bd358f412282 Revises: 0b337376e9f7 -Create Date: 2022-07-11 17:56:19.608275 +Create Date: 2022-07-12 09:24:59.328369 """ from alembic import op @@ -10,7 +10,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = 'ec4f4f4ae9db' +revision = 'bd358f412282' down_revision = '0b337376e9f7' branch_labels = None depends_on = None @@ -20,11 +20,15 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('are_correspondants_entreprise_id_fkey', 'are_correspondants', type_='foreignkey') op.drop_column('are_correspondants', 'entreprise_id') + op.add_column('are_entreprises', sa.Column('siret_provisoire', sa.Boolean(), nullable=True)) + op.create_index(op.f('ix_are_entreprises_siret'), 'are_entreprises', ['siret'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### + op.drop_index(op.f('ix_are_entreprises_siret'), table_name='are_entreprises') + op.drop_column('are_entreprises', 'siret_provisoire') op.add_column('are_correspondants', sa.Column('entreprise_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.create_foreign_key('are_correspondants_entreprise_id_fkey', 'are_correspondants', 'are_entreprises', ['entreprise_id'], ['id'], ondelete='CASCADE') # ### end Alembic commands ###