fix downgrade, ajout colonnes sur les tables relations entreprises

This commit is contained in:
Arthur ZHU 2022-04-20 22:37:45 +02:00
parent cf0a136071
commit 196f80e210
2 changed files with 41 additions and 3 deletions

View File

@ -0,0 +1,34 @@
"""ajout colonnes tables relations entreprises
Revision ID: b1e6885bae70
Revises: e97b2a10f86c
Create Date: 2022-04-20 21:45:42.828853
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b1e6885bae70'
down_revision = 'e97b2a10f86c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('are_correspondants', sa.Column('civilite', sa.String(length=1), nullable=True))
op.add_column('are_correspondants', sa.Column('origine', sa.Text(), nullable=True))
op.add_column('are_correspondants', sa.Column('notes', sa.Text(), nullable=True))
op.add_column('are_entreprises', sa.Column('active', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('are_entreprises', 'active')
op.drop_column('are_correspondants', 'notes')
op.drop_column('are_correspondants', 'origine')
op.drop_column('are_correspondants', 'civilite')
# ### end Alembic commands ###

View File

@ -93,7 +93,9 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "are_offres", type_="foreignkey")
op.drop_constraint(
"are_offres_correspondant_id_fkey", "are_offres", type_="foreignkey"
)
op.drop_column("are_offres", "correspondant_id")
op.add_column(
"are_contacts",
@ -121,8 +123,10 @@ def downgrade():
op.add_column(
"are_contacts", sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True)
)
op.drop_constraint(None, "are_contacts", type_="foreignkey")
op.drop_constraint(None, "are_contacts", type_="foreignkey")
op.drop_constraint(
"are_contacts_entreprise_fkey", "are_contacts", type_="foreignkey"
)
op.drop_constraint("are_contacts_user_fkey", "are_contacts", type_="foreignkey")
op.create_foreign_key(
"are_contacts_entreprise_id_fkey",
"are_contacts",