mirror of
https://github.com/gogs/gogs.git
synced 2026-01-15 11:52:21 +01:00
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
16 lines
292 B
Go
16 lines
292 B
Go
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")
|
|
}
|