Skip to content

Commit

Permalink
feat(group-attributes): Add new column for group first release (#6055)
Browse files Browse the repository at this point in the history
Add a new column with a different name for the Group.first_release field to the GroupAttributes table.
  • Loading branch information
snigdhas committed Jun 25, 2024
1 parent 5b3a54f commit 553fd81
Showing 1 changed file with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from typing import Sequence

from snuba.clickhouse.columns import Column, UInt
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 OperationTarget, SqlOperation


class Migration(migration.ClickhouseNodeMigration):
blocking = False

def forwards_ops(self) -> Sequence[SqlOperation]:
return [
operations.AddColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_local",
column=Column(
"group_first_release",
UInt(64, Modifiers(nullable=True)),
),
target=OperationTarget.LOCAL,
after="group_priority",
),
operations.AddColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_dist",
column=Column(
"group_first_release",
UInt(64, Modifiers(nullable=True)),
),
target=OperationTarget.DISTRIBUTED,
after="group_priority",
),
]

def backwards_ops(self) -> Sequence[SqlOperation]:
return [
operations.DropColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_dist",
column_name="group_first_release",
target=OperationTarget.DISTRIBUTED,
),
operations.DropColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_local",
column_name="group_first_release",
target=OperationTarget.LOCAL,
),
]

0 comments on commit 553fd81

Please sign in to comment.