ajout siret provisoire

This commit is contained in:
Arthur ZHU 2022-07-12 10:32:23 +02:00
parent 9898ae5310
commit f4514ad4ea
2 changed files with 10 additions and 5 deletions

View File

@ -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)

View File

@ -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 ###