mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
SQLStore: Disable redundant create and drop unique index migrations on dashboard table (#86857)
SQLStore: Disable create and drop unique index migrations
This commit is contained in:
parent
17a3ec52b6
commit
a5a3ee9fa3
@ -5,6 +5,18 @@ import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
type DummyMigration struct {
|
||||
migrator.MigrationBase
|
||||
}
|
||||
|
||||
func (m *DummyMigration) SQL(dialect migrator.Dialect) string {
|
||||
return "code migration"
|
||||
}
|
||||
|
||||
func (m *DummyMigration) Exec(sess *xorm.Session, mgrtr *migrator.Migrator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// FolderUIDMigration is a code migration that populates folder_uid column
|
||||
type FolderUIDMigration struct {
|
||||
migrator.MigrationBase
|
||||
@ -78,17 +90,13 @@ func AddDashboardFolderMigrations(mg *migrator.Migrator) {
|
||||
|
||||
mg.AddMigration("Populate dashboard folder_uid column", &FolderUIDMigration{})
|
||||
|
||||
mg.AddMigration("Add unique index for dashboard_org_id_folder_uid_title", migrator.NewAddIndexMigration(migrator.Table{Name: "dashboard"}, &migrator.Index{
|
||||
Cols: []string{"org_id", "folder_uid", "title"}, Type: migrator.UniqueIndex,
|
||||
}))
|
||||
mg.AddMigration("Add unique index for dashboard_org_id_folder_uid_title", &DummyMigration{})
|
||||
|
||||
mg.AddMigration("Delete unique index for dashboard_org_id_folder_id_title", migrator.NewDropIndexMigration(migrator.Table{Name: "dashboard"}, &migrator.Index{
|
||||
Cols: []string{"org_id", "folder_id", "title"}, Type: migrator.UniqueIndex,
|
||||
}))
|
||||
|
||||
mg.AddMigration("Delete unique index for dashboard_org_id_folder_uid_title", migrator.NewDropIndexMigration(migrator.Table{Name: "dashboard"}, &migrator.Index{
|
||||
Cols: []string{"org_id", "folder_uid", "title"}, Type: migrator.UniqueIndex,
|
||||
}))
|
||||
mg.AddMigration("Delete unique index for dashboard_org_id_folder_uid_title", &DummyMigration{})
|
||||
|
||||
mg.AddMigration("Add unique index for dashboard_org_id_folder_uid_title_is_folder", migrator.NewAddIndexMigration(migrator.Table{Name: "dashboard"}, &migrator.Index{
|
||||
Cols: []string{"org_id", "folder_uid", "title", "is_folder"}, Type: migrator.UniqueIndex,
|
||||
|
Loading…
Reference in New Issue
Block a user