-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(group-attributes): Modify the column type for `group_first_releas…
…e_id` to bigint (#6040) * Modify the column type to bigint * Fix types * Add migration to group_loader * Add OperationTarget
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from typing import Sequence | ||
|
||
from snuba.clickhouse.columns import UUID, 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.ModifyColumn( | ||
storage_set=StorageSetKey.GROUP_ATTRIBUTES, | ||
table_name="group_attributes_local", | ||
column=Column( | ||
"group_first_release_id", UInt(64, Modifiers(nullable=True)) | ||
), | ||
target=OperationTarget.LOCAL, | ||
), | ||
operations.ModifyColumn( | ||
storage_set=StorageSetKey.GROUP_ATTRIBUTES, | ||
table_name="group_attributes_dist", | ||
column=Column( | ||
"group_first_release_id", UInt(64, Modifiers(nullable=True)) | ||
), | ||
target=OperationTarget.DISTRIBUTED, | ||
), | ||
] | ||
|
||
def backwards_ops(self) -> Sequence[SqlOperation]: | ||
return [ | ||
operations.ModifyColumn( | ||
storage_set=StorageSetKey.GROUP_ATTRIBUTES, | ||
table_name="group_attributes_dist", | ||
column=Column("group_first_release_id", UUID(Modifiers(nullable=True))), | ||
target=OperationTarget.DISTRIBUTED, | ||
), | ||
operations.ModifyColumn( | ||
storage_set=StorageSetKey.GROUP_ATTRIBUTES, | ||
table_name="group_attributes_local", | ||
column=Column("group_first_release_id", UUID(Modifiers(nullable=True))), | ||
target=OperationTarget.LOCAL, | ||
), | ||
] |