Commit 7aa84aeb by bergquist

moves migrations to /sqlstore/migrations

parent dbcc2e86
...@@ -36,7 +36,7 @@ func (sl *ServerLockService) LockAndExecute(ctx context.Context, actionName stri ...@@ -36,7 +36,7 @@ func (sl *ServerLockService) LockAndExecute(ctx context.Context, actionName stri
return err 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 { if rowLock.LastExecution != 0 {
lastExeuctionTime := time.Unix(rowLock.LastExecution, 0) lastExeuctionTime := time.Unix(rowLock.LastExecution, 0)
if lastExeuctionTime.Unix() > time.Now().Add(-maxInterval).Unix() { if lastExeuctionTime.Unix() > time.Now().Add(-maxInterval).Unix() {
......
...@@ -31,6 +31,7 @@ func AddMigrations(mg *Migrator) { ...@@ -31,6 +31,7 @@ func AddMigrations(mg *Migrator) {
addTagMigration(mg) addTagMigration(mg)
addLoginAttemptMigrations(mg) addLoginAttemptMigrations(mg)
addUserAuthMigrations(mg) addUserAuthMigrations(mg)
addServerlockMigrations(mg)
} }
func addMigrationLogMigrations(mg *Migrator) { func addMigrationLogMigrations(mg *Migrator) {
......
package serverlock package migrations
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator" import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
// AddMigration create database migrations for server lock func addServerlockMigrations(mg *migrator.Migrator) {
func (sl *ServerLockService) AddMigration(mg *migrator.Migrator) {
serverLock := migrator.Table{ serverLock := migrator.Table{
Name: "server_lock", Name: "server_lock",
Columns: []*migrator.Column{ Columns: []*migrator.Column{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment