mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* Chore: Fix issues reported by staticcheck Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Apply suggestions from code review Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
28 lines
921 B
Go
Executable File
28 lines
921 B
Go
Executable File
package migrations
|
|
|
|
import (
|
|
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
)
|
|
|
|
func addShortURLMigrations(mg *Migrator) {
|
|
shortURLV1 := Table{
|
|
Name: "short_url",
|
|
Columns: []*Column{
|
|
{Name: "id", Type: DB_BigInt, Nullable: false, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
{Name: "org_id", Type: DB_BigInt, Nullable: false},
|
|
{Name: "uid", Type: DB_NVarchar, Length: 40, Nullable: false},
|
|
{Name: "path", Type: DB_Text, Nullable: false},
|
|
{Name: "created_by", Type: DB_Int, Nullable: false},
|
|
{Name: "created_at", Type: DB_Int, Nullable: false},
|
|
{Name: "last_seen_at", Type: DB_Int, Nullable: true},
|
|
},
|
|
Indices: []*Index{
|
|
{Cols: []string{"org_id", "uid"}, Type: UniqueIndex},
|
|
},
|
|
}
|
|
|
|
mg.AddMigration("create short_url table v1", NewAddTableMigration(shortURLV1))
|
|
|
|
mg.AddMigration("add index short_url.org_id-uid", NewAddIndexMigration(shortURLV1, shortURLV1.Indices[0]))
|
|
}
|