You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: folder_uid_migrator.go
    path of file: ./repos/grafana/pkg/services/dashboards/database/migrations
    
    the code of the file until where you have to start completion: package migrations

import (
	"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
	"xorm.io/xorm"
)

// FolderUIDMigration is a code migration that populates folder_uid column
type FolderUIDMigration struct {
	migrator.MigrationBase
}

func (m *FolderUIDMigration) SQL(dialect migrator.Dialect) string {
	return "code migration"
}

func (m *FolderUIDMigration) Exec(sess *xorm.Session, mgrtr *migrator.Migrator) error {
	// for dashboards the source of truth is the  dashboard table
	q := `UPDATE dashboard
	SET folder_uid = folder.uid
	FROM dashboard folder
	WHERE dashboard.folder_id = folder.id
	  AND dashboard.is_folder = ?`
	if mgrtr.Dialect.DriverName() == migrator.MySQL {
		q = `UPDATE dashboard AS d
		LEFT JOIN dashboard AS folder ON d.fold
    
func AddDashboardFolderMigrations(mg *migrator.Migrator) {
	mg.AddMigration("Add folder_uid for dashboard", migrator.NewAddColumnMigration(migrator.Table{Name: "dashboard"}, &migrator.Column{
		Name: "folder_uid", Type: migrator.DB_NVarchar, Length: 40, Nullable: true,
	}))

	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("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("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,
	}))

	// Temporary index until decommisioning of folder_id in query
	mg.AddMigration("Restore index for dashboard_org_id_folder_id_title", migrator.NewAddIndexMigration(migrator.Table{Name: "dashboard"}, &migrator.Index{
		Cols: []string{"org_id", "folder_id", "title"},
	}))
}