moves migrations to /sqlstore/migrations

This commit is contained in:
bergquist 2018-12-13 09:52:13 +01:00
parent dbcc2e868d
commit 7aa84aeb61
3 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ func (sl *ServerLockService) LockAndExecute(ctx context.Context, actionName stri
return err
}
// avoid execution if last lock happened less than `matInterval` ago
// avoid execution if last lock happened less than `maxInterval` ago
if rowLock.LastExecution != 0 {
lastExeuctionTime := time.Unix(rowLock.LastExecution, 0)
if lastExeuctionTime.Unix() > time.Now().Add(-maxInterval).Unix() {

View File

@ -31,6 +31,7 @@ func AddMigrations(mg *Migrator) {
addTagMigration(mg)
addLoginAttemptMigrations(mg)
addUserAuthMigrations(mg)
addServerlockMigrations(mg)
}
func addMigrationLogMigrations(mg *Migrator) {

View File

@ -1,9 +1,8 @@
package serverlock
package migrations
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
// AddMigration create database migrations for server lock
func (sl *ServerLockService) AddMigration(mg *migrator.Migrator) {
func addServerlockMigrations(mg *migrator.Migrator) {
serverLock := migrator.Table{
Name: "server_lock",
Columns: []*migrator.Column{