diff --git a/pkg/services/sqlstore/migrations/alert_mig.go b/pkg/services/sqlstore/migrations/alert_mig.go index 84014bd386f..86e7b3933b4 100644 --- a/pkg/services/sqlstore/migrations/alert_mig.go +++ b/pkg/services/sqlstore/migrations/alert_mig.go @@ -144,7 +144,7 @@ func addAlertMigrations(mg *Migrator) { mg.AddMigration("Update uid column values in alert_notification", new(RawSqlMigration). Sqlite("UPDATE alert_notification SET uid=printf('%09d',id) WHERE uid IS NULL;"). - Postgres("UPDATE alert_notification SET uid=lpad('' || id,9,'0') WHERE uid IS NULL;"). + Postgres("UPDATE alert_notification SET uid=lpad('' || id::text,9,'0') WHERE uid IS NULL;"). Mysql("UPDATE alert_notification SET uid=lpad(id,9,'0') WHERE uid IS NULL;")) mg.AddMigration("Add unique index alert_notification_org_id_uid", NewAddIndexMigration(alert_notification, &Index{ diff --git a/pkg/services/sqlstore/migrations/dashboard_mig.go b/pkg/services/sqlstore/migrations/dashboard_mig.go index b770afb1b4e..b47261d06d7 100644 --- a/pkg/services/sqlstore/migrations/dashboard_mig.go +++ b/pkg/services/sqlstore/migrations/dashboard_mig.go @@ -157,7 +157,7 @@ func addDashboardMigration(mg *Migrator) { mg.AddMigration("Update uid column values in dashboard", NewRawSqlMigration(""). Sqlite("UPDATE dashboard SET uid=printf('%09d',id) WHERE uid IS NULL;"). - Postgres("UPDATE dashboard SET uid=lpad('' || id,9,'0') WHERE uid IS NULL;"). + Postgres("UPDATE dashboard SET uid=lpad('' || id::text,9,'0') WHERE uid IS NULL;"). Mysql("UPDATE dashboard SET uid=lpad(id,9,'0') WHERE uid IS NULL;")) mg.AddMigration("Add unique index dashboard_org_id_uid", NewAddIndexMigration(dashboardV2, &Index{ diff --git a/pkg/services/sqlstore/migrator/postgres_dialect.go b/pkg/services/sqlstore/migrator/postgres_dialect.go index ce529920a39..799535ce225 100644 --- a/pkg/services/sqlstore/migrator/postgres_dialect.go +++ b/pkg/services/sqlstore/migrator/postgres_dialect.go @@ -110,7 +110,7 @@ func (db *Postgres) IndexCheckSql(tableName, indexName string) (string, []interf func (db *Postgres) DropIndexSql(tableName string, index *Index) string { quote := db.Quote idxName := index.XName(tableName) - return fmt.Sprintf("DROP INDEX %v", quote(idxName)) + return fmt.Sprintf("DROP INDEX %v CASCADE", quote(idxName)) } func (db *Postgres) UpdateTableSql(tableName string, columns []*Column) string {