Skip to content

Commit

Permalink
Add OperationTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
snigdhas committed Jun 18, 2024
1 parent 8c9a2af commit c1b8001
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -18,26 +18,30 @@ 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,
table_name="group_attributes_dist",
column=Column(
"group_first_release_id", UInt(64, Modifiers(nullable=True))
),
target=OperationTarget.DISTRIBUTED,
),
]

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,
),
]

0 comments on commit c1b8001

Please sign in to comment.