From bddc5544f9db74fd7712b9373fe4d9d14a0f7eda Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 22 Aug 2024 17:13:58 +0300 Subject: [PATCH 1/8] Delete moonworm from seer abi jobs. --- moonstreamapi/moonstreamapi/actions.py | 2 +- .../moonstreamapi/admin/moonworm_tasks.py | 4 +- .../versions/8647da37ed5a_remove_old_name.py | 38 +++++++++++++++++++ .../moonstreamdbv3/models_indexes.py | 2 +- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py diff --git a/moonstreamapi/moonstreamapi/actions.py b/moonstreamapi/moonstreamapi/actions.py index f4d35cb6..795f6261 100644 --- a/moonstreamapi/moonstreamapi/actions.py +++ b/moonstreamapi/moonstreamapi/actions.py @@ -707,7 +707,7 @@ def add_abi_to_db( "status": "active", "historical_crawl_status": "pending", "progress": 0, - "moonworm_task_pickedup": False, + "task_pickedup": False, "abi": json.dumps(abi), } diff --git a/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py b/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py index f6dd1dd5..706c1c6d 100644 --- a/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py +++ b/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py @@ -141,7 +141,7 @@ def create_v3_task( "status": "active", "historical_crawl_status": "pending", "progress": 0, - "moonworm_task_pickedup": False, + "task_pickedup": False, "abi": json.dumps(abi_task), } ) @@ -318,7 +318,7 @@ def migrate_v3_tasks( "status": "active", "historical_crawl_status": "pending", "progress": 0, - "moonworm_task_pickedup": False, + "task_pickedup": False, "abi": json.dumps(abi_task), } diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py new file mode 100644 index 00000000..e0bfdde9 --- /dev/null +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py @@ -0,0 +1,38 @@ +"""remove-old-name + +Revision ID: 8647da37ed5a +Revises: 48d2562504d1 +Create Date: 2024-08-22 17:10:28.949610 + +""" + +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = "8647da37ed5a" +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.add_column("abi_jobs", sa.Column("task_pickedup", sa.Boolean(), nullable=False)) + op.drop_column("abi_jobs", "moonworm_task_pickedup") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "abi_jobs", + sa.Column( + "moonworm_task_pickedup", sa.BOOLEAN(), autoincrement=False, nullable=False + ), + ) + op.drop_column("abi_jobs", "task_pickedup") + # ### end Alembic commands ### diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index 4cbd8c02..bb18678a 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -801,7 +801,7 @@ class AbiJobs(Base): status = Column(VARCHAR(256), nullable=False, index=True) historical_crawl_status = Column(VARCHAR(256), nullable=False, index=True) progress = Column(Integer, nullable=False, index=False) - moonworm_task_pickedup = Column(Boolean, nullable=False, index=False) + task_pickedup = Column(Boolean, nullable=False, index=False) abi = Column(Text, nullable=False) created_at = Column( DateTime(timezone=True), server_default=utcnow(), nullable=False From 9a1b53a4d7785e92ccd7bb96e53e199adcd36ea2 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 23 Aug 2024 16:52:30 +0300 Subject: [PATCH 2/8] Add deploy block. --- .../versions/8647da37ed5a_remove_old_name.py | 38 ------------------- .../moonstreamdbv3/models_indexes.py | 1 + 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py deleted file mode 100644 index e0bfdde9..00000000 --- a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8647da37ed5a_remove_old_name.py +++ /dev/null @@ -1,38 +0,0 @@ -"""remove-old-name - -Revision ID: 8647da37ed5a -Revises: 48d2562504d1 -Create Date: 2024-08-22 17:10:28.949610 - -""" - -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = "8647da37ed5a" -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.add_column("abi_jobs", sa.Column("task_pickedup", sa.Boolean(), nullable=False)) - op.drop_column("abi_jobs", "moonworm_task_pickedup") - # ### end Alembic commands ### - - -def downgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "abi_jobs", - sa.Column( - "moonworm_task_pickedup", sa.BOOLEAN(), autoincrement=False, nullable=False - ), - ) - op.drop_column("abi_jobs", "task_pickedup") - # ### end Alembic commands ### diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index bb18678a..bc9f17b7 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -802,6 +802,7 @@ class AbiJobs(Base): historical_crawl_status = Column(VARCHAR(256), nullable=False, index=True) progress = Column(Integer, nullable=False, index=False) task_pickedup = Column(Boolean, nullable=False, index=False) + deployment_block_number = Column(BigInteger, nullable=False, index=False) abi = Column(Text, nullable=False) created_at = Column( DateTime(timezone=True), server_default=utcnow(), nullable=False From 4136daf21026444fbc7acabfa336ec6195d68a1d Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 25 Aug 2024 14:06:15 +0300 Subject: [PATCH 3/8] Fix nullable. --- moonstreamdb-v3/moonstreamdbv3/models_indexes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index bc9f17b7..e4615caa 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -802,7 +802,7 @@ class AbiJobs(Base): historical_crawl_status = Column(VARCHAR(256), nullable=False, index=True) progress = Column(Integer, nullable=False, index=False) task_pickedup = Column(Boolean, nullable=False, index=False) - deployment_block_number = Column(BigInteger, nullable=False, index=False) + deployment_block_number = Column(BigInteger, nullable=True, index=False) abi = Column(Text, nullable=False) created_at = Column( DateTime(timezone=True), server_default=utcnow(), nullable=False From 49b6b98eb5d1df2850a937b3135671a7212318a1 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 29 Aug 2024 19:57:00 +0300 Subject: [PATCH 4/8] 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 ### From 309f81b95cdabffc342fd044f54fb1d788023c37 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 17 Sep 2024 15:46:23 +0300 Subject: [PATCH 5/8] Update version --- .../alembic_indexes/versions/6807bdf6f417_add_deploy_block.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 34c69c9c..5fce71cd 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py @@ -14,7 +14,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = "6807bdf6f417" -down_revision: Union[str, None] = "48d2562504d1" +down_revision: Union[str, None] = "25b339f55f8f" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None From 781a0c4643aee6cfabcd9ec5c97bf1279fb3035a Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 24 Sep 2024 20:17:50 +0300 Subject: [PATCH 6/8] Delete name change. --- .../versions/6807bdf6f417_add_deploy_block.py | 14 -------------- moonstreamdb-v3/moonstreamdbv3/models_indexes.py | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) 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 index 5fce71cd..8b58872f 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py @@ -21,13 +21,6 @@ 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), @@ -37,12 +30,5 @@ def upgrade() -> None: 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 ### diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index ce75bc27..89d015df 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -817,7 +817,7 @@ class AbiJobs(Base): status = Column(VARCHAR(256), nullable=False, index=True) historical_crawl_status = Column(VARCHAR(256), nullable=False, index=True) progress = Column(Integer, nullable=False, index=False) - task_pickedup = Column(Boolean, nullable=False, index=False) + moonworm_task_pickedup = Column(Boolean, nullable=False, index=False) deployment_block_number = Column(BigInteger, nullable=True, index=False) abi = Column(Text, nullable=False) created_at = Column( From a3e1c92c83ceaba72df799e467ca8402141c44bd Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 24 Sep 2024 20:20:20 +0300 Subject: [PATCH 7/8] Bump version. --- moonstreamdb-v3/moonstreamdbv3/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moonstreamdb-v3/moonstreamdbv3/version.txt b/moonstreamdb-v3/moonstreamdbv3/version.txt index 32786aa4..44517d51 100644 --- a/moonstreamdb-v3/moonstreamdbv3/version.txt +++ b/moonstreamdb-v3/moonstreamdbv3/version.txt @@ -1 +1 @@ -0.0.18 +0.0.19 From d4f37f15be42b748fb60f46f81db9c0aa0d62e5c Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 24 Sep 2024 20:41:30 +0300 Subject: [PATCH 8/8] Revert name change. --- moonstreamapi/moonstreamapi/actions.py | 2 +- moonstreamapi/moonstreamapi/admin/moonworm_tasks.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/moonstreamapi/moonstreamapi/actions.py b/moonstreamapi/moonstreamapi/actions.py index 795f6261..f4d35cb6 100644 --- a/moonstreamapi/moonstreamapi/actions.py +++ b/moonstreamapi/moonstreamapi/actions.py @@ -707,7 +707,7 @@ def add_abi_to_db( "status": "active", "historical_crawl_status": "pending", "progress": 0, - "task_pickedup": False, + "moonworm_task_pickedup": False, "abi": json.dumps(abi), } diff --git a/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py b/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py index 706c1c6d..f6dd1dd5 100644 --- a/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py +++ b/moonstreamapi/moonstreamapi/admin/moonworm_tasks.py @@ -141,7 +141,7 @@ def create_v3_task( "status": "active", "historical_crawl_status": "pending", "progress": 0, - "task_pickedup": False, + "moonworm_task_pickedup": False, "abi": json.dumps(abi_task), } ) @@ -318,7 +318,7 @@ def migrate_v3_tasks( "status": "active", "historical_crawl_status": "pending", "progress": 0, - "task_pickedup": False, + "moonworm_task_pickedup": False, "abi": json.dumps(abi_task), }