From c6a90ed3cd47f496602bbd678f83f6bdab49d237 Mon Sep 17 00:00:00 2001 From: Matthew Jacobson Date: Fri, 15 Nov 2024 10:43:56 -0500 Subject: [PATCH] Alerting: Fix long KeepLast annotations failing to save (#96503) Certain combinations of KeepLast state transition annotations exceed the current limit of 25 characters. This increases the column size limit to be able to handle the longest combination (27) with some extra space for comfort. --- pkg/services/sqlstore/migrations/annotation_mig.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/services/sqlstore/migrations/annotation_mig.go b/pkg/services/sqlstore/migrations/annotation_mig.go index dd23ffea93d..c11ab34dd13 100644 --- a/pkg/services/sqlstore/migrations/annotation_mig.go +++ b/pkg/services/sqlstore/migrations/annotation_mig.go @@ -183,6 +183,14 @@ func addAnnotationMig(mg *Migrator) { mg.AddMigration("Increase tags column to length 4096", NewRawSQLMigration(""). Postgres("ALTER TABLE annotation ALTER COLUMN tags TYPE VARCHAR(4096);"). Mysql("ALTER TABLE annotation MODIFY tags VARCHAR(4096);")) + + mg.AddMigration("Increase prev_state column to length 40", NewRawSQLMigration(""). + Postgres("ALTER TABLE annotation ALTER COLUMN prev_state TYPE VARCHAR(40);"). + Mysql("ALTER TABLE annotation MODIFY prev_state VARCHAR(40);")) + + mg.AddMigration("Increase new_state column to length 40", NewRawSQLMigration(""). + Postgres("ALTER TABLE annotation ALTER COLUMN new_state TYPE VARCHAR(40);"). + Mysql("ALTER TABLE annotation MODIFY new_state VARCHAR(40);")) } type AddMakeRegionSingleRowMigration struct {