blob: 0a1c74b0612e33987cc49ca7cb999d8a4c9533f9 (
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 nil
}
return db.Migrator().CreateIndex(&action{}, "UserID")
}
|