Skip to content

Commit 530118b

Browse files
authored
feat(search-issues): Add message column to search issues (#4385)
* 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
1 parent 7a07b74 commit 530118b

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

snuba/migrations/group_loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ def get_migrations(self) -> Sequence[str]:
311311
"0006_add_subtitle_culprit_level_resource_id",
312312
"0007_add_transaction_duration",
313313
"0008_add_profile_id_replay_id",
314+
"0009_add_message",
314315
]
315316

316317

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from typing import Sequence
2+
3+
from snuba.clickhouse.columns import Column, String
4+
from snuba.clusters.storage_sets import StorageSetKey
5+
from snuba.migrations import migration, operations
6+
from snuba.migrations.operations import OperationTarget
7+
8+
9+
class Migration(migration.ClickhouseNodeMigration):
10+
blocking = False
11+
12+
def forwards_ops(self) -> Sequence[operations.SqlOperation]:
13+
ops = [
14+
[
15+
operations.AddColumn(
16+
storage_set=StorageSetKey.SEARCH_ISSUES,
17+
table_name=table_name,
18+
column=Column("message", String()),
19+
after="replay_id",
20+
target=target,
21+
),
22+
]
23+
for table_name, target in [
24+
("search_issues_local_v2", OperationTarget.LOCAL),
25+
("search_issues_dist_v2", OperationTarget.DISTRIBUTED),
26+
]
27+
]
28+
return ops[0] + ops[1]
29+
30+
def backwards_ops(self) -> Sequence[operations.SqlOperation]:
31+
ops = [
32+
[
33+
operations.DropColumn(
34+
storage_set=StorageSetKey.SEARCH_ISSUES,
35+
table_name=table_name,
36+
column_name="message",
37+
target=target,
38+
),
39+
]
40+
for table_name, target in [
41+
("search_issues_dist_v2", OperationTarget.DISTRIBUTED),
42+
("search_issues_local_v2", OperationTarget.LOCAL),
43+
]
44+
]
45+
return ops[0] + ops[1]

0 commit comments

Comments
 (0)