From 49b6b98eb5d1df2850a937b3135671a7212318a1 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 29 Aug 2024 19:57:00 +0300 Subject: [PATCH] Add migration. --- .../versions/6807bdf6f417_add_deploy_block.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py new file mode 100644 index 00000000..34c69c9c --- /dev/null +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py @@ -0,0 +1,48 @@ +"""Add deploy block + +Revision ID: 6807bdf6f417 +Revises: 48d2562504d1 +Create Date: 2024-08-23 16:51:47.147758 + +""" + +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = "6807bdf6f417" +down_revision: Union[str, None] = "48d2562504d1" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column( + "abi_jobs", + "moonworm_task_pickedup", + existing_type=sa.BOOLEAN(), + nullable=False, + new_column_name="task_pickedup", + ) + op.add_column( + "abi_jobs", + sa.Column("deployment_block_number", sa.BigInteger(), nullable=True), + ) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column( + "abi_jobs", + "task_pickedup", + existing_type=sa.BOOLEAN(), + nullable=False, + new_column_name="moonworm_task_pickedup", + ) + op.drop_column("abi_jobs", "deployment_block_number") + # ### end Alembic commands ###