From 196f80e2105d39f3c61e82118bfa5ee06c069cdd Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Wed, 20 Apr 2022 22:37:45 +0200 Subject: [PATCH] fix downgrade, ajout colonnes sur les tables relations entreprises --- ...5bae70_ajout_colonnes_tables_relations_.py | 34 +++++++++++++++++++ ...0f86c_tables_module_gestions_relations_.py | 10 ++++-- 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 migrations/versions/b1e6885bae70_ajout_colonnes_tables_relations_.py diff --git a/migrations/versions/b1e6885bae70_ajout_colonnes_tables_relations_.py b/migrations/versions/b1e6885bae70_ajout_colonnes_tables_relations_.py new file mode 100644 index 000000000..68d698042 --- /dev/null +++ b/migrations/versions/b1e6885bae70_ajout_colonnes_tables_relations_.py @@ -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 ### diff --git a/migrations/versions/e97b2a10f86c_tables_module_gestions_relations_.py b/migrations/versions/e97b2a10f86c_tables_module_gestions_relations_.py index 3580022f9..b4a1995e6 100644 --- a/migrations/versions/e97b2a10f86c_tables_module_gestions_relations_.py +++ b/migrations/versions/e97b2a10f86c_tables_module_gestions_relations_.py @@ -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",