From ab5ec167b71469ac1b15d1426d87cdf50bf15a22 Mon Sep 17 00:00:00 2001 From: Snigdha Sharma Date: Tue, 18 Jun 2024 13:43:37 -0700 Subject: [PATCH] Modify the column type to bigint --- .../0004_fix_group_first_release_id_type.py | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py diff --git a/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py b/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py new file mode 100644 index 00000000000..e7c0d0d0326 --- /dev/null +++ b/snuba/snuba_migrations/group_attributes/0004_fix_group_first_release_id_type.py @@ -0,0 +1,43 @@ +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.ModifyColumn( + storage_set=StorageSetKey.GROUP_ATTRIBUTES, + table_name="group_attributes_local", + column=Column( + "group_first_release_id", UInt(64, Modifiers(nullable=True)) + ), + ), + operations.ModifyColumn( + storage_set=StorageSetKey.GROUP_ATTRIBUTES, + table_name="group_attributes_dist", + column=Column( + "group_first_release_id", UInt(64, Modifiers(nullable=True)) + ), + ), + ] + + def backwards_ops(self) -> Sequence[SqlOperation]: + return [ + operations.ModifyColumn( + storage_set=StorageSetKey.GROUP_ATTRIBUTES, + table_name="group_attributes_local", + column=Column("group_first_release_id", UUID(Modifiers(nullable=True))), + ), + operations.ModifyColumn( + storage_set=StorageSetKey.GROUP_ATTRIBUTES, + table_name="group_attributes_dist", + column=Column("group_first_release_id", UUID(Modifiers(nullable=True))), + ), + ]