mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1_20
|
|
|
|
import (
|
|
"github.com/hanzoai/git/models/db"
|
|
"github.com/hanzoai/git/modules/timeutil"
|
|
|
|
"github.com/hanzoai/xorm/schemas"
|
|
)
|
|
|
|
type Action struct {
|
|
UserID int64 // Receiver user id.
|
|
ActUserID int64 // Action user id.
|
|
RepoID int64
|
|
IsDeleted bool `xorm:"NOT NULL DEFAULT false"`
|
|
IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
|
|
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
|
}
|
|
|
|
// TableName sets the name of this table
|
|
func (a *Action) TableName() string {
|
|
return "action"
|
|
}
|
|
|
|
// TableIndices implements xorm's TableIndices interface
|
|
func (a *Action) TableIndices() []*schemas.Index {
|
|
repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)
|
|
repoIndex.AddColumn("repo_id", "user_id", "is_deleted")
|
|
|
|
actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
|
|
actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
|
|
|
|
cudIndex := schemas.NewIndex("c_u_d", schemas.IndexType)
|
|
cudIndex.AddColumn("created_unix", "user_id", "is_deleted")
|
|
|
|
indices := []*schemas.Index{actUserIndex, repoIndex, cudIndex}
|
|
|
|
return indices
|
|
}
|
|
|
|
func ImproveActionTableIndices(x db.EngineMigration) error {
|
|
return x.Sync(new(Action))
|
|
}
|