521034349543_add_consultancy_account_to_account.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """Add consultancy account to Account
  2. Revision ID: 521034349543
  3. Revises: 40d6c8e4be94
  4. Create Date: 2023-10-13 11:07:08.013181
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = "521034349543"
  10. down_revision = "40d6c8e4be94"
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. # ### commands auto generated by Alembic - please adjust! ###
  15. with op.batch_alter_table("account", schema=None) as batch_op:
  16. batch_op.add_column(
  17. sa.Column("consultancy_account_id", sa.Integer(), nullable=True)
  18. )
  19. batch_op.create_foreign_key(
  20. batch_op.f("account_consultancy_account_id_account_fkey"),
  21. "account",
  22. ["consultancy_account_id"],
  23. ["id"],
  24. )
  25. # ### end Alembic commands ###
  26. def downgrade():
  27. # ### commands auto generated by Alembic - please adjust! ###
  28. with op.batch_alter_table("account", schema=None) as batch_op:
  29. batch_op.drop_constraint(
  30. batch_op.f("account_consultancy_account_id_account_fkey"),
  31. type_="foreignkey",
  32. )
  33. batch_op.drop_column("consultancy_account_id")
  34. # ### end Alembic commands ###