1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Rename Sync2 -> Sync (#26479)

The xorm `Sync2` has already been deprecated in favor of `Sync`,
so let's do the same inside the Gitea codebase.

Command used to replace everything:
```sh
for i in $(ag Sync2 --files-with-matches); do vim $i -c ':%sno/Sync2/Sync/g' -c ':wq'; done
```
This commit is contained in:
delvh
2023-08-13 21:17:21 +02:00
committed by GitHub
parent 50fc22eecf
commit e10ba5e5e0
122 changed files with 184 additions and 184 deletions

View File

@@ -12,5 +12,5 @@ func AddBlockOnRejectedReviews(x *xorm.Engine) error {
BlockOnRejectedReviews bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync2(new(ProtectedBranch))
return x.Sync(new(ProtectedBranch))
}

View File

@@ -18,8 +18,8 @@ func AddReviewCommitAndStale(x *xorm.Engine) error {
}
// Old reviews will have commit ID set to "" and not stale
if err := x.Sync2(new(Review)); err != nil {
if err := x.Sync(new(Review)); err != nil {
return err
}
return x.Sync2(new(ProtectedBranch))
return x.Sync(new(ProtectedBranch))
}

View File

@@ -11,7 +11,7 @@ func AddOwnerNameOnRepository(x *xorm.Engine) error {
type Repository struct {
OwnerName string
}
if err := x.Sync2(new(Repository)); err != nil {
if err := x.Sync(new(Repository)); err != nil {
return err
}
_, err := x.Exec("UPDATE repository SET owner_name = (SELECT name FROM `user` WHERE `user`.id = repository.owner_id)")

View File

@@ -12,5 +12,5 @@ func AddIsRestricted(x *xorm.Engine) error {
IsRestricted bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync2(new(User))
return x.Sync(new(User))
}

View File

@@ -12,5 +12,5 @@ func AddRequireSignedCommits(x *xorm.Engine) error {
RequireSignedCommits bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync2(new(ProtectedBranch))
return x.Sync(new(ProtectedBranch))
}

View File

@@ -13,5 +13,5 @@ func AddReactionOriginals(x *xorm.Engine) error {
OriginalAuthor string
}
return x.Sync2(new(Reaction))
return x.Sync(new(Reaction))
}

View File

@@ -19,5 +19,5 @@ func AddUserRepoMissingColumns(x *xorm.Engine) error {
Topics []string `xorm:"TEXT JSON"`
}
return x.Sync2(new(User), new(Repository))
return x.Sync(new(User), new(Repository))
}

View File

@@ -15,8 +15,8 @@ func AddReviewMigrateInfo(x *xorm.Engine) error {
OriginalAuthorID int64
}
if err := x.Sync2(new(Review)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(Review)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -34,11 +34,11 @@ func AddLanguageStats(x *xorm.Engine) error {
IndexerType RepoIndexerType `xorm:"INDEX(s) NOT NULL DEFAULT 0"`
}
if err := x.Sync2(new(LanguageStat)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(LanguageStat)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
if err := x.Sync2(new(RepoIndexerStatus)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(RepoIndexerStatus)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -14,8 +14,8 @@ func AddSystemWebhookColumn(x *xorm.Engine) error {
IsSystemWebhook bool `xorm:"NOT NULL DEFAULT false"`
}
if err := x.Sync2(new(Webhook)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(Webhook)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -14,8 +14,8 @@ func AddBranchProtectionProtectedFilesColumn(x *xorm.Engine) error {
ProtectedFilePatterns string `xorm:"TEXT"`
}
if err := x.Sync2(new(ProtectedBranch)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(ProtectedBranch)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -11,5 +11,5 @@ func AddEmailHashTable(x *xorm.Engine) error {
Hash string `xorm:"pk varchar(32)"`
Email string `xorm:"UNIQUE NOT NULL"`
}
return x.Sync2(new(EmailHash))
return x.Sync(new(EmailHash))
}

View File

@@ -14,8 +14,8 @@ func AddOrgIDLabelColumn(x *xorm.Engine) error {
OrgID int64 `xorm:"INDEX"`
}
if err := x.Sync2(new(Label)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(Label)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -42,8 +42,8 @@ func AddCommitDivergenceToPulls(x *xorm.Engine) error {
MergedCommitID string `xorm:"VARCHAR(40)"`
}
if err := x.Sync2(new(PullRequest)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(PullRequest)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
last := 0

View File

@@ -11,5 +11,5 @@ func AddBlockOnOutdatedBranch(x *xorm.Engine) error {
type ProtectedBranch struct {
BlockOnOutdatedBranch bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync2(new(ProtectedBranch))
return x.Sync(new(ProtectedBranch))
}

View File

@@ -14,8 +14,8 @@ func AddResolveDoerIDCommentColumn(x *xorm.Engine) error {
ResolveDoerID int64
}
if err := x.Sync2(new(Comment)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(Comment)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}