blob: 7eb97a7fa311e6b38bfd95625f504d7930f4c2d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Copyright 2022 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package migrations
import (
"gorm.io/gorm"
)
func addIndexToActionUserID(db *gorm.DB) error {
type action struct {
UserID string `gorm:"index"`
}
if db.Migrator().HasIndex(&action{}, "UserID") {
return errMigrationSkipped
}
return db.Migrator().CreateIndex(&action{}, "UserID")
}
|