SQLStore: Add deprecation comments for breaking migrations (#49740) (#50183)

* Migrator: Extend support to rename columns

* SQLStore: Add deprecation comments for breaking migrations

(cherry picked from commit 5f1305d280)

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-06-03 18:02:27 +02:00
committed by GitHub
co-authored by Joan López de la Franca Beltran
parent 78d5e3e0dd
commit fc4018048e
5 changed files with 35 additions and 21 deletions
@@ -20,6 +20,8 @@ func addTableIndicesMigrations(mg *Migrator, versionSuffix string, table Table)
}
}
// addTableRenameMigration may cause breaking changes.
// DEPRECATED: It should no longer be used. Kept only for legacy reasons.
func addTableRenameMigration(mg *Migrator, oldName string, newName string, versionSuffix string) {
migrationId := fmt.Sprintf("Rename table %s to %s - %s", oldName, newName, versionSuffix)
mg.AddMigration(migrationId, NewRenameTableMigration(oldName, newName))
@@ -44,7 +44,7 @@ func addSecretsMigration(mg *migrator.Migrator) {
mg.AddMigration("create secrets table", migrator.NewAddTableMigration(secretsV1))
mg.AddMigration("rename data_keys name column to id", migrator.NewRenameColumnMigration(
dataKeysV1, "name", "id",
dataKeysV1, dataKeysV1.Columns[0], "id",
))
mg.AddMigration("add name column into data_keys", migrator.NewAddColumnMigration(