Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(group-attributes): Drop group_first_release_id column #6048

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.DropColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_local",
column_name="group_first_release_id",
target=OperationTarget.LOCAL,
),
operations.DropColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_dist",
column_name="group_first_release_id",
target=OperationTarget.DISTRIBUTED,
),
]

def backwards_ops(self) -> Sequence[SqlOperation]:
return [
operations.AddColumn(
storage_set=StorageSetKey.GROUP_ATTRIBUTES,
table_name="group_attributes_dist",
column=Column(
"group_first_release_id",
UUID(Modifiers(nullable=True)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking here. Would UUID be the desired column type for the reverse operation (i.e. adding back the new column)? Or is UInt64 the correct type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like the type change didn't work? so I assumed it wasn't safe to rollback to that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we can rollback to UUID. I suppose when we add back the column, we'll add it with the Uint64 type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's the plan!

),
target=OperationTarget.DISTRIBUTED,
after="group_priority",
),
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",
),
]
1 change: 1 addition & 0 deletions snuba/migrations/group_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ def get_migrations(self) -> Sequence[str]:
"0001_group_attributes",
"0002_add_priority_to_group_attributes",
"0003_add_first_release_id_to_group_attributes",
"0004_drop_first_release_id_from_group_attributes",
]


Expand Down
Loading