From c1b8001a899baaf479fed9064d83de2be4b496db Mon Sep 17 00:00:00 2001 From: Snigdha Sharma Date: Tue, 18 Jun 2024 14:40:37 -0700 Subject: [PATCH] Add OperationTarget --- .../0004_fix_group_first_release_id_type.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py b/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py index 952915cb65..cd441c6c25 100644 --- a/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py +++ b/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py @@ -4,7 +4,7 @@ from snuba.clusters.storage_sets import StorageSetKey from snuba.migrations import migration, operations from snuba.migrations.columns import MigrationModifiers as Modifiers -from snuba.migrations.operations import SqlOperation +from snuba.migrations.operations import OperationTarget, SqlOperation class Migration(migration.ClickhouseNodeMigration): @@ -18,6 +18,7 @@ def forwards_ops(self) -> Sequence[SqlOperation]: column=Column( "group_first_release_id", UInt(64, Modifiers(nullable=True)) ), + target=OperationTarget.LOCAL, ), operations.ModifyColumn( storage_set=StorageSetKey.GROUP_ATTRIBUTES, @@ -25,6 +26,7 @@ def forwards_ops(self) -> Sequence[SqlOperation]: column=Column( "group_first_release_id", UInt(64, Modifiers(nullable=True)) ), + target=OperationTarget.DISTRIBUTED, ), ] @@ -32,12 +34,14 @@ def backwards_ops(self) -> Sequence[SqlOperation]: return [ operations.ModifyColumn( storage_set=StorageSetKey.GROUP_ATTRIBUTES, - table_name="group_attributes_local", + table_name="group_attributes_dist", column=Column("group_first_release_id", UUID(Modifiers(nullable=True))), + target=OperationTarget.DISTRIBUTED, ), operations.ModifyColumn( storage_set=StorageSetKey.GROUP_ATTRIBUTES, - table_name="group_attributes_dist", + table_name="group_attributes_local", column=Column("group_first_release_id", UUID(Modifiers(nullable=True))), + target=OperationTarget.LOCAL, ), ]