Skip to content

Commit

Permalink
feat(search-issues): Add message column to search issues (#4385)
Browse files Browse the repository at this point in the history
* This adds the `message` column to search issues table, since we missed it initially..

Related to getsentry/sentry#50345

* remove __init__ so check stops complaining
  • Loading branch information
wedamija authored Jun 21, 2023
1 parent 7a07b74 commit 530118b
Show file tree
Hide file tree
Showing 2 changed files with 46 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 @@ -311,6 +311,7 @@ def get_migrations(self) -> Sequence[str]:
"0006_add_subtitle_culprit_level_resource_id",
"0007_add_transaction_duration",
"0008_add_profile_id_replay_id",
"0009_add_message",
]


Expand Down
45 changes: 45 additions & 0 deletions snuba/snuba_migrations/search_issues/0009_add_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from typing import Sequence

from snuba.clickhouse.columns import Column, String
from snuba.clusters.storage_sets import StorageSetKey
from snuba.migrations import migration, operations
from snuba.migrations.operations import OperationTarget


class Migration(migration.ClickhouseNodeMigration):
blocking = False

def forwards_ops(self) -> Sequence[operations.SqlOperation]:
ops = [
[
operations.AddColumn(
storage_set=StorageSetKey.SEARCH_ISSUES,
table_name=table_name,
column=Column("message", String()),
after="replay_id",
target=target,
),
]
for table_name, target in [
("search_issues_local_v2", OperationTarget.LOCAL),
("search_issues_dist_v2", OperationTarget.DISTRIBUTED),
]
]
return ops[0] + ops[1]

def backwards_ops(self) -> Sequence[operations.SqlOperation]:
ops = [
[
operations.DropColumn(
storage_set=StorageSetKey.SEARCH_ISSUES,
table_name=table_name,
column_name="message",
target=target,
),
]
for table_name, target in [
("search_issues_dist_v2", OperationTarget.DISTRIBUTED),
("search_issues_local_v2", OperationTarget.LOCAL),
]
]
return ops[0] + ops[1]

0 comments on commit 530118b

Please sign in to comment.