Skip to content

Commit 362fa2c

Browse files
authored
Merge branch 'main' into lunny/fix_wrong_review_request
2 parents ca6c8d4 + 4ed0724 commit 362fa2c

File tree

26 files changed

+179
-38
lines changed

26 files changed

+179
-38
lines changed

models/actions/artifact.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,25 @@ const (
3030
ArtifactStatusDeleted // 6, ArtifactStatusDeleted is the status of an artifact that is deleted
3131
)
3232

33+
func (status ArtifactStatus) ToString() string {
34+
switch status {
35+
case ArtifactStatusUploadPending:
36+
return "upload is not yet completed"
37+
case ArtifactStatusUploadConfirmed:
38+
return "upload is completed"
39+
case ArtifactStatusUploadError:
40+
return "upload failed"
41+
case ArtifactStatusExpired:
42+
return "expired"
43+
case ArtifactStatusPendingDeletion:
44+
return "pending deletion"
45+
case ArtifactStatusDeleted:
46+
return "deleted"
47+
default:
48+
return "unknown"
49+
}
50+
}
51+
3352
func init() {
3453
db.RegisterModel(new(ActionArtifact))
3554
}

models/fixtures/action_artifact.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@
1111
content_encoding: ""
1212
artifact_path: "abc.txt"
1313
artifact_name: "artifact-download"
14+
status: 2
15+
created_unix: 1712338649
16+
updated_unix: 1712338649
17+
expired_unix: 1720114649
18+
19+
-
20+
id: 2
21+
run_id: 791
22+
runner_id: 1
23+
repo_id: 4
24+
owner_id: 1
25+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
26+
storage_path: ""
27+
file_size: 1024
28+
file_compressed_size: 1024
29+
content_encoding: "30/20/1712348022422036662.chunk"
30+
artifact_path: "abc.txt"
31+
artifact_name: "artifact-download-incomplete"
1432
status: 1
1533
created_unix: 1712338649
1634
updated_unix: 1712338649

models/migrations/v1_23/v299.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ func AddContentVersionToIssueAndComment(x *xorm.Engine) error {
1414
ContentVersion int `xorm:"NOT NULL DEFAULT 0"`
1515
}
1616

17-
return x.Sync(new(Comment), new(Issue))
17+
_, err := x.SyncWithOptions(xorm.SyncOptions{
18+
IgnoreConstrains: true,
19+
IgnoreIndices: true,
20+
}, new(Comment), new(Issue))
21+
return err
1822
}

models/migrations/v1_23/v300.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@ func AddForcePushBranchProtection(x *xorm.Engine) error {
1313
ForcePushAllowlistTeamIDs []int64 `xorm:"JSON TEXT"`
1414
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
1515
}
16-
return x.Sync(new(ProtectedBranch))
16+
_, err := x.SyncWithOptions(xorm.SyncOptions{
17+
IgnoreConstrains: true,
18+
IgnoreIndices: true,
19+
}, new(ProtectedBranch))
20+
return err
1721
}

models/migrations/v1_23/v301.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ func AddSkipSecondaryAuthColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
1010
type oauth2Application struct {
1111
SkipSecondaryAuthorization bool `xorm:"NOT NULL DEFAULT FALSE"`
1212
}
13-
return x.Sync(new(oauth2Application))
13+
_, err := x.SyncWithOptions(xorm.SyncOptions{
14+
IgnoreConstrains: true,
15+
IgnoreIndices: true,
16+
}, new(oauth2Application))
17+
return err
1418
}

models/migrations/v1_23/v303.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ func AddCommentMetaDataColumn(x *xorm.Engine) error {
1919
CommentMetaData *CommentMetaData `xorm:"JSON TEXT"` // put all non-index metadata in a single field
2020
}
2121

22-
return x.Sync(new(Comment))
22+
_, err := x.SyncWithOptions(xorm.SyncOptions{
23+
IgnoreConstrains: true,
24+
IgnoreIndices: true,
25+
}, new(Comment))
26+
return err
2327
}

models/migrations/v1_23/v306.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ func AddBlockAdminMergeOverrideBranchProtection(x *xorm.Engine) error {
99
type ProtectedBranch struct {
1010
BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"`
1111
}
12-
return x.Sync(new(ProtectedBranch))
12+
_, err := x.SyncWithOptions(xorm.SyncOptions{
13+
IgnoreConstrains: true,
14+
IgnoreIndices: true,
15+
}, new(ProtectedBranch))
16+
return err
1317
}

models/migrations/v1_23/v310.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ func AddPriorityToProtectedBranch(x *xorm.Engine) error {
1212
Priority int64 `xorm:"NOT NULL DEFAULT 0"`
1313
}
1414

15-
return x.Sync(new(ProtectedBranch))
15+
_, err := x.SyncWithOptions(xorm.SyncOptions{
16+
IgnoreConstrains: true,
17+
IgnoreIndices: true,
18+
}, new(ProtectedBranch))
19+
return err
1620
}

models/migrations/v1_23/v311.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ func AddTimeEstimateColumnToIssueTable(x *xorm.Engine) error {
1111
type Issue struct {
1212
TimeEstimate int64 `xorm:"NOT NULL DEFAULT 0"`
1313
}
14-
15-
return x.Sync(new(Issue))
14+
_, err := x.SyncWithOptions(xorm.SyncOptions{
15+
IgnoreConstrains: true,
16+
IgnoreIndices: true,
17+
}, new(Issue))
18+
return err
1619
}

models/migrations/v1_24/v312.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ func (pullAutoMerge) TableName() string {
1717
}
1818

1919
func AddDeleteBranchAfterMergeForAutoMerge(x *xorm.Engine) error {
20-
return x.Sync(new(pullAutoMerge))
20+
_, err := x.SyncWithOptions(xorm.SyncOptions{
21+
IgnoreConstrains: true,
22+
IgnoreIndices: true,
23+
}, new(pullAutoMerge))
24+
return err
2125
}

0 commit comments

Comments
 (0)