mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
23 lines
825 B
Go
23 lines
825 B
Go
package migrations
|
|
|
|
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
|
|
func addServerlockMigrations(mg *migrator.Migrator) {
|
|
serverLock := migrator.Table{
|
|
Name: "server_lock",
|
|
Columns: []*migrator.Column{
|
|
{Name: "id", Type: migrator.DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
{Name: "operation_uid", Type: migrator.DB_NVarchar, Length: 100},
|
|
{Name: "version", Type: migrator.DB_BigInt},
|
|
{Name: "last_execution", Type: migrator.DB_BigInt, Nullable: false},
|
|
},
|
|
Indices: []*migrator.Index{
|
|
{Cols: []string{"operation_uid"}, Type: migrator.UniqueIndex},
|
|
},
|
|
}
|
|
|
|
mg.AddMigration("create server_lock table", migrator.NewAddTableMigration(serverLock))
|
|
|
|
mg.AddMigration("add index server_lock.operation_uid", migrator.NewAddIndexMigration(serverLock, serverLock.Indices[0]))
|
|
}
|