Skip to content

Commit 4c157e7

Browse files
committed
Merge remote-tracking branch 'upstream/main' into sync-on-push
2 parents f2de0a0 + c174bdc commit 4c157e7

33 files changed

+516
-200
lines changed

Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ else
1717
DIST := dist
1818
DIST_DIRS := $(DIST)/binaries $(DIST)/release
1919
IMPORT := code.gitea.io/gitea
20-
export GO111MODULE=on
2120

2221
GO ?= go
2322
SHASUM ?= shasum -a 256
@@ -363,7 +362,7 @@ test\#%:
363362
coverage:
364363
grep '^\(mode: .*\)\|\(.*:[0-9]\+\.[0-9]\+,[0-9]\+\.[0-9]\+ [0-9]\+ [0-9]\+\)$$' coverage.out > coverage-bodged.out
365364
grep '^\(mode: .*\)\|\(.*:[0-9]\+\.[0-9]\+,[0-9]\+\.[0-9]\+ [0-9]\+ [0-9]\+\)$$' integration.coverage.out > integration.coverage-bodged.out
366-
GO111MODULE=on $(GO) run build/gocovmerge.go integration.coverage-bodged.out coverage-bodged.out > coverage.all || (echo "gocovmerge failed"; echo "integration.coverage.out"; cat integration.coverage.out; echo "coverage.out"; cat coverage.out; exit 1)
365+
$(GO) run build/gocovmerge.go integration.coverage-bodged.out coverage-bodged.out > coverage.all || (echo "gocovmerge failed"; echo "integration.coverage.out"; cat integration.coverage.out; echo "coverage.out"; cat coverage.out; exit 1)
367366

368367
.PHONY: unit-test-coverage
369368
unit-test-coverage:
@@ -754,11 +753,11 @@ update-translations:
754753

755754
.PHONY: generate-license
756755
generate-license:
757-
GO111MODULE=on $(GO) run build/generate-licenses.go
756+
$(GO) run build/generate-licenses.go
758757

759758
.PHONY: generate-gitignore
760759
generate-gitignore:
761-
GO111MODULE=on $(GO) run build/generate-gitignores.go
760+
$(GO) run build/generate-gitignores.go
762761

763762
.PHONY: generate-images
764763
generate-images: | node_modules

cmd/admin_auth_ldap.go

+14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ var (
3434
Name: "not-active",
3535
Usage: "Deactivate the authentication source.",
3636
},
37+
cli.BoolFlag{
38+
Name: "active",
39+
Usage: "Activate the authentication source.",
40+
},
3741
cli.StringFlag{
3842
Name: "security-protocol",
3943
Usage: "Security protocol name.",
@@ -117,6 +121,10 @@ var (
117121
Name: "synchronize-users",
118122
Usage: "Enable user synchronization.",
119123
},
124+
cli.BoolFlag{
125+
Name: "disable-synchronize-users",
126+
Usage: "Disable user synchronization.",
127+
},
120128
cli.UintFlag{
121129
Name: "page-size",
122130
Usage: "Search page size.",
@@ -183,9 +191,15 @@ func parseAuthSource(c *cli.Context, authSource *auth.Source) {
183191
if c.IsSet("not-active") {
184192
authSource.IsActive = !c.Bool("not-active")
185193
}
194+
if c.IsSet("active") {
195+
authSource.IsActive = c.Bool("active")
196+
}
186197
if c.IsSet("synchronize-users") {
187198
authSource.IsSyncEnabled = c.Bool("synchronize-users")
188199
}
200+
if c.IsSet("disable-synchronize-users") {
201+
authSource.IsSyncEnabled = !c.Bool("disable-synchronize-users")
202+
}
189203
}
190204

191205
// parseLdapConfig assigns values on config according to command line flags.

cmd/admin_auth_ldap_test.go

+57
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,36 @@ func TestUpdateLdapBindDn(t *testing.T) {
858858
},
859859
errMsg: "Invalid authentication type. expected: LDAP (via BindDN), actual: OAuth2",
860860
},
861+
// case 24
862+
{
863+
args: []string{
864+
"ldap-test",
865+
"--id", "24",
866+
"--name", "ldap (via Bind DN) flip 'active' and 'user sync' attributes",
867+
"--active",
868+
"--disable-synchronize-users",
869+
},
870+
id: 24,
871+
existingAuthSource: &auth.Source{
872+
Type: auth.LDAP,
873+
IsActive: false,
874+
IsSyncEnabled: true,
875+
Cfg: &ldap.Source{
876+
Name: "ldap (via Bind DN) flip 'active' and 'user sync' attributes",
877+
Enabled: true,
878+
},
879+
},
880+
authSource: &auth.Source{
881+
Type: auth.LDAP,
882+
Name: "ldap (via Bind DN) flip 'active' and 'user sync' attributes",
883+
IsActive: true,
884+
IsSyncEnabled: false,
885+
Cfg: &ldap.Source{
886+
Name: "ldap (via Bind DN) flip 'active' and 'user sync' attributes",
887+
Enabled: true,
888+
},
889+
},
890+
},
861891
}
862892

863893
for n, c := range cases {
@@ -1221,6 +1251,33 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
12211251
},
12221252
errMsg: "Invalid authentication type. expected: LDAP (simple auth), actual: PAM",
12231253
},
1254+
// case 20
1255+
{
1256+
args: []string{
1257+
"ldap-test",
1258+
"--id", "20",
1259+
"--name", "ldap (simple auth) flip 'active' attribute",
1260+
"--active",
1261+
},
1262+
id: 20,
1263+
existingAuthSource: &auth.Source{
1264+
Type: auth.DLDAP,
1265+
IsActive: false,
1266+
Cfg: &ldap.Source{
1267+
Name: "ldap (simple auth) flip 'active' attribute",
1268+
Enabled: true,
1269+
},
1270+
},
1271+
authSource: &auth.Source{
1272+
Type: auth.DLDAP,
1273+
Name: "ldap (simple auth) flip 'active' attribute",
1274+
IsActive: true,
1275+
Cfg: &ldap.Source{
1276+
Name: "ldap (simple auth) flip 'active' attribute",
1277+
Enabled: true,
1278+
},
1279+
},
1280+
},
12241281
}
12251282

12261283
for n, c := range cases {

cmd/dump_repo.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"strings"
1111

1212
"code.gitea.io/gitea/modules/convert"
13+
"code.gitea.io/gitea/modules/git"
1314
"code.gitea.io/gitea/modules/log"
1415
base "code.gitea.io/gitea/modules/migration"
1516
"code.gitea.io/gitea/modules/setting"
@@ -83,6 +84,11 @@ func runDumpRepository(ctx *cli.Context) error {
8384
return err
8485
}
8586

87+
// migrations.GiteaLocalUploader depends on git module
88+
if err := git.InitSimple(context.Background()); err != nil {
89+
return err
90+
}
91+
8692
log.Info("AppPath: %s", setting.AppPath)
8793
log.Info("AppWorkPath: %s", setting.AppWorkPath)
8894
log.Info("Custom path: %s", setting.CustomPath)
@@ -128,7 +134,9 @@ func runDumpRepository(ctx *cli.Context) error {
128134
} else {
129135
units := strings.Split(ctx.String("units"), ",")
130136
for _, unit := range units {
131-
switch strings.ToLower(unit) {
137+
switch strings.ToLower(strings.TrimSpace(unit)) {
138+
case "":
139+
continue
132140
case "wiki":
133141
opts.Wiki = true
134142
case "issues":
@@ -145,6 +153,8 @@ func runDumpRepository(ctx *cli.Context) error {
145153
opts.Comments = true
146154
case "pull_requests":
147155
opts.PullRequests = true
156+
default:
157+
return errors.New("invalid unit: " + unit)
148158
}
149159
}
150160
}

cmd/restore_repo.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package cmd
77
import (
88
"errors"
99
"net/http"
10+
"strings"
1011

1112
"code.gitea.io/gitea/modules/log"
1213
"code.gitea.io/gitea/modules/private"
@@ -37,10 +38,10 @@ var CmdRestoreRepository = cli.Command{
3738
Value: "",
3839
Usage: "Restore destination repository name",
3940
},
40-
cli.StringSliceFlag{
41+
cli.StringFlag{
4142
Name: "units",
42-
Value: nil,
43-
Usage: `Which items will be restored, one or more units should be repeated with this flag.
43+
Value: "",
44+
Usage: `Which items will be restored, one or more units should be separated as comma.
4445
wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`,
4546
},
4647
cli.BoolFlag{
@@ -55,13 +56,16 @@ func runRestoreRepository(c *cli.Context) error {
5556
defer cancel()
5657

5758
setting.LoadFromExisting()
58-
59+
var units []string
60+
if s := c.String("units"); s != "" {
61+
units = strings.Split(s, ",")
62+
}
5963
statusCode, errStr := private.RestoreRepo(
6064
ctx,
6165
c.String("repo_dir"),
6266
c.String("owner_name"),
6367
c.String("repo_name"),
64-
c.StringSlice("units"),
68+
units,
6569
c.Bool("validation"),
6670
)
6771
if statusCode == http.StatusOK {

custom/conf/app.example.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ PATH =
16761676
;ENABLED = true
16771677
;;
16781678
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
1679-
;ALLOWED_TYPES = .docx,.gif,.gz,.jpeg,.jpg,.mp4,.log,.pdf,.png,.pptx,.txt,.xlsx,.zip
1679+
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
16801680
;;
16811681
;; Max size of each file. Defaults to 4MB
16821682
;MAX_SIZE = 4

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ Default templates for project boards:
742742
## Issue and pull request attachments (`attachment`)
743743

744744
- `ENABLED`: **true**: Whether issue and pull request attachments are enabled.
745-
- `ALLOWED_TYPES`: **.docx,.gif,.gz,.jpeg,.jpg,mp4,.log,.pdf,.png,.pptx,.txt,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
745+
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
746746
- `MAX_SIZE`: **4**: Maximum size (MB).
747747
- `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once.
748748
- `STORAGE_TYPE`: **local**: Storage type for attachments, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ require (
6666
github.com/mattn/go-isatty v0.0.14
6767
github.com/mattn/go-sqlite3 v1.14.12
6868
github.com/mholt/archiver/v3 v3.5.1
69-
github.com/microcosm-cc/bluemonday v1.0.18
69+
github.com/microcosm-cc/bluemonday v1.0.19
7070
github.com/minio/minio-go/v7 v7.0.26
7171
github.com/msteinert/pam v1.0.0
7272
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
@@ -93,9 +93,9 @@ require (
9393
go.jolheiser.com/hcaptcha v0.0.4
9494
go.jolheiser.com/pwn v0.0.3
9595
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122
96-
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
96+
golang.org/x/net v0.0.0-20220630215102-69896b714898
9797
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
98-
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
98+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
9999
golang.org/x/text v0.3.7
100100
golang.org/x/tools v0.1.10
101101
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df

go.sum

+6-7
Original file line numberDiff line numberDiff line change
@@ -1154,8 +1154,8 @@ github.com/mholt/acmez v1.0.2 h1:C8wsEBIUVi6e0DYoxqCcFuXtwc4AWXL/jgcDjF7mjVo=
11541154
github.com/mholt/acmez v1.0.2/go.mod h1:8qnn8QA/Ewx8E3ZSsmscqsIjhhpxuy9vqdgbX2ceceM=
11551155
github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=
11561156
github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
1157-
github.com/microcosm-cc/bluemonday v1.0.18 h1:6HcxvXDAi3ARt3slx6nTesbvorIc3QeTzBNRvWktHBo=
1158-
github.com/microcosm-cc/bluemonday v1.0.18/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM=
1157+
github.com/microcosm-cc/bluemonday v1.0.19 h1:OI7hoF5FY4pFz2VA//RN8TfM0YJ2dJcl4P4APrCWy6c=
1158+
github.com/microcosm-cc/bluemonday v1.0.19/go.mod h1:QNzV2UbLK2/53oIIwTOyLUSABMkjZ4tqiyC1g/DyqxE=
11591159
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
11601160
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
11611161
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
@@ -1793,14 +1793,13 @@ golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qx
17931793
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
17941794
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
17951795
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
1796-
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
17971796
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
17981797
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
17991798
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
18001799
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
18011800
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
1802-
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
1803-
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
1801+
golang.org/x/net v0.0.0-20220630215102-69896b714898 h1:K7wO6V1IrczY9QOQ2WkVpw4JQSwCd52UsxVEirZUfiw=
1802+
golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
18041803
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
18051804
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
18061805
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1947,8 +1946,8 @@ golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBc
19471946
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
19481947
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
19491948
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1950-
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
1951-
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1949+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
1950+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
19521951
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
19531952
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
19541953
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=

integrations/migrate_test.go

+56
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
package integrations
66

77
import (
8+
"fmt"
9+
"net/http"
10+
"net/url"
811
"os"
912
"testing"
1013

14+
repo_model "code.gitea.io/gitea/models/repo"
1115
"code.gitea.io/gitea/models/unittest"
1216
user_model "code.gitea.io/gitea/models/user"
1317
"code.gitea.io/gitea/modules/setting"
18+
"code.gitea.io/gitea/modules/structs"
1419
"code.gitea.io/gitea/services/migrations"
1520

1621
"github.com/stretchr/testify/assert"
@@ -40,3 +45,54 @@ func TestMigrateLocalPath(t *testing.T) {
4045

4146
setting.ImportLocalPaths = old
4247
}
48+
49+
func TestMigrateGiteaForm(t *testing.T) {
50+
onGiteaRun(t, func(t *testing.T, u *url.URL) {
51+
AllowLocalNetworks := setting.Migrations.AllowLocalNetworks
52+
setting.Migrations.AllowLocalNetworks = true
53+
AppVer := setting.AppVer
54+
// Gitea SDK (go-sdk) need to parse the AppVer from server response, so we must set it to a valid version string.
55+
setting.AppVer = "1.16.0"
56+
defer func() {
57+
setting.Migrations.AllowLocalNetworks = AllowLocalNetworks
58+
setting.AppVer = AppVer
59+
migrations.Init()
60+
}()
61+
assert.NoError(t, migrations.Init())
62+
63+
ownerName := "user2"
64+
repoName := "repo1"
65+
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: ownerName}).(*user_model.User)
66+
session := loginUser(t, ownerName)
67+
token := getTokenForLoggedInUser(t, session)
68+
69+
// Step 0: verify the repo is available
70+
req := NewRequestf(t, "GET", fmt.Sprintf("/%s/%s", ownerName, repoName))
71+
_ = session.MakeRequest(t, req, http.StatusOK)
72+
// Step 1: get the Gitea migration form
73+
req = NewRequestf(t, "GET", "/repo/migrate/?service_type=%d", structs.GiteaService)
74+
resp := session.MakeRequest(t, req, http.StatusOK)
75+
// Step 2: load the form
76+
htmlDoc := NewHTMLParser(t, resp.Body)
77+
link, exists := htmlDoc.doc.Find(`form.ui.form[action^="/repo/migrate"]`).Attr("action")
78+
assert.True(t, exists, "The template has changed")
79+
// Step 4: submit the migration to only migrate issues
80+
migratedRepoName := "otherrepo"
81+
req = NewRequestWithValues(t, "POST", link, map[string]string{
82+
"_csrf": htmlDoc.GetCSRF(),
83+
"service": fmt.Sprintf("%d", structs.GiteaService),
84+
"clone_addr": fmt.Sprintf("%s%s/%s", u, ownerName, repoName),
85+
"auth_token": token,
86+
"issues": "on",
87+
"repo_name": migratedRepoName,
88+
"description": "",
89+
"uid": fmt.Sprintf("%d", repoOwner.ID),
90+
})
91+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
92+
// Step 5: a redirection displays the migrated repository
93+
loc := resp.Header().Get("Location")
94+
assert.EqualValues(t, fmt.Sprintf("/%s/%s", ownerName, migratedRepoName), loc)
95+
// Step 6: check the repo was created
96+
unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: migratedRepoName})
97+
})
98+
}

models/action.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ func init() {
9292

9393
// TableIndices implements xorm's TableIndices interface
9494
func (a *Action) TableIndices() []*schemas.Index {
95+
repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)
96+
repoIndex.AddColumn("repo_id", "user_id", "is_deleted")
97+
9598
actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
9699
actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
97100

98-
repoIndex := schemas.NewIndex("r_c_u_d", schemas.IndexType)
99-
repoIndex.AddColumn("repo_id", "created_unix", "user_id", "is_deleted")
100-
101101
return []*schemas.Index{actUserIndex, repoIndex}
102102
}
103103

0 commit comments

Comments
 (0)