Skip to content

Commit

Permalink
feat(issue-search): Add group_first_release_id to the GroupAttributes…
Browse files Browse the repository at this point in the history
… table (#5986)

* Add group_first_release_id to the group_attributes table

* Add migration to GroupAttributesLoader

* Change field type to UUID

* style(lint): Auto commit lint changes

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
  • Loading branch information
snigdhas and getsantry[bot] authored Jun 7, 2024
1 parent c12292b commit b79a63b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions snuba/migrations/group_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ def get_migrations(self) -> Sequence[str]:
return [
"0001_group_attributes",
"0002_add_priority_to_group_attributes",
"0003_add_first_release_id_to_group_attributes",
]


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from typing import Sequence

from snuba.clickhouse.columns import UUID, Column
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_id",
UUID(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_id",
UUID(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_id",
target=OperationTarget.DISTRIBUTED,
),
operations.DropColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_local",
column_name="group_first_release_id",
target=OperationTarget.LOCAL,
),
]

0 comments on commit b79a63b

Please sign in to comment.