Skip to content

Commit 5662acd

Browse files
committed
Merge branch 'notification-table' of github.com:jolheiser/gitea into notification-table
2 parents 5dc42c5 + 83aba0b commit 5662acd

File tree

4 files changed

+52
-7
lines changed

4 files changed

+52
-7
lines changed

models/activities/action.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,10 @@ func (a *Action) TableIndices() []*schemas.Index {
9898
actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
9999
actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
100100

101-
indices := []*schemas.Index{actUserIndex, repoIndex}
102-
if setting.Database.Type.IsPostgreSQL() {
103-
cudIndex := schemas.NewIndex("c_u_d", schemas.IndexType)
104-
cudIndex.AddColumn("created_unix", "user_id", "is_deleted")
105-
indices = append(indices, cudIndex)
106-
}
101+
cudIndex := schemas.NewIndex("c_u_d", schemas.IndexType)
102+
cudIndex.AddColumn("created_unix", "user_id", "is_deleted")
103+
104+
indices := []*schemas.Index{actUserIndex, repoIndex, cudIndex}
107105

108106
return indices
109107
}

models/migrations/migrations.go

+2
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ var migrations = []Migration{
475475
NewMigration("Fix incorrect project type", v1_20.FixIncorrectProjectType),
476476
// v248 -> v249
477477
NewMigration("Add version column to action_runner table", v1_20.AddVersionToActionRunner),
478+
// v249 -> v250
479+
NewMigration("Improve Action table indices v3", v1_20.ImproveActionTableIndices),
478480
}
479481

480482
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v249.go

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import (
7+
"code.gitea.io/gitea/modules/timeutil"
8+
9+
"xorm.io/xorm"
10+
"xorm.io/xorm/schemas"
11+
)
12+
13+
type Action struct {
14+
UserID int64 // Receiver user id.
15+
ActUserID int64 // Action user id.
16+
RepoID int64
17+
IsDeleted bool `xorm:"NOT NULL DEFAULT false"`
18+
IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
19+
CreatedUnix timeutil.TimeStamp `xorm:"created"`
20+
}
21+
22+
// TableName sets the name of this table
23+
func (a *Action) TableName() string {
24+
return "action"
25+
}
26+
27+
// TableIndices implements xorm's TableIndices interface
28+
func (a *Action) TableIndices() []*schemas.Index {
29+
repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)
30+
repoIndex.AddColumn("repo_id", "user_id", "is_deleted")
31+
32+
actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
33+
actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
34+
35+
cudIndex := schemas.NewIndex("c_u_d", schemas.IndexType)
36+
cudIndex.AddColumn("created_unix", "user_id", "is_deleted")
37+
38+
indices := []*schemas.Index{actUserIndex, repoIndex, cudIndex}
39+
40+
return indices
41+
}
42+
43+
func ImproveActionTableIndices(x *xorm.Engine) error {
44+
return x.Sync(new(Action))
45+
}

options/locale/locale_en-US.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -3149,7 +3149,7 @@ error.unit_not_allowed = You are not allowed to access this repository section.
31493149
title = Packages
31503150
desc = Manage repository packages.
31513151
empty = There are no packages yet.
3152-
empty.documentation = For more information on the package registry, see <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/overview">the documentation</a>.
3152+
empty.documentation = For more information on the package registry, see <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/usage/packages/overview/">the documentation</a>.
31533153
empty.repo = Did you upload a package, but it's not shown here? Go to <a href="%[1]s">package settings</a> and link it to this repo.
31543154
filter.type = Type
31553155
filter.type.all = All

0 commit comments

Comments
 (0)