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

@@ -58,7 +58,7 @@ func UnwrapLDAPSourceCfg(x *xorm.Engine) error {
}
// change lower_email as unique
if err := x.Sync2(new(LoginSource)); err != nil {
if err := x.Sync(new(LoginSource)); err != nil {
return err
}

View File

@@ -16,7 +16,7 @@ func AddAgitFlowPullRequest(x *xorm.Engine) error {
Flow PullRequestFlow `xorm:"NOT NULL DEFAULT 0"`
}
if err := x.Sync2(new(PullRequest)); err != nil {
if err := x.Sync(new(PullRequest)); err != nil {
return fmt.Errorf("sync2: %w", err)
}
return nil

View File

@@ -16,7 +16,7 @@ func AddRepoIDForAttachment(x *xorm.Engine) error {
ReleaseID int64 `xorm:"INDEX"` // maybe zero when creating
UploaderID int64 `xorm:"INDEX DEFAULT 0"`
}
if err := x.Sync2(new(Attachment)); err != nil {
if err := x.Sync(new(Attachment)); err != nil {
return err
}

View File

@@ -14,8 +14,8 @@ func AddBranchProtectionUnprotectedFilesColumn(x *xorm.Engine) error {
UnprotectedFilePatterns 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

@@ -18,8 +18,8 @@ func AddTableCommitStatusIndex(x *xorm.Engine) error {
MaxIndex int64 `xorm:"index"`
}
if err := x.Sync2(new(CommitStatusIndex)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(CommitStatusIndex)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
sess := x.NewSession()

View File

@@ -14,8 +14,8 @@ func AddColorColToProjectBoard(x *xorm.Engine) error {
Color string `xorm:"VARCHAR(7)"`
}
if err := x.Sync2(new(ProjectBoard)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(ProjectBoard)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -15,5 +15,5 @@ func AddRenamedBranchTable(x *xorm.Engine) error {
To string
CreatedUnix int64 `xorm:"created"`
}
return x.Sync2(new(RenamedBranch))
return x.Sync(new(RenamedBranch))
}

View File

@@ -25,8 +25,8 @@ func AddTableIssueContentHistory(x *xorm.Engine) error {
sess := x.NewSession()
defer sess.Close()
if err := sess.Sync2(new(IssueContentHistory)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := sess.Sync(new(IssueContentHistory)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return sess.Commit()
}

View File

@@ -15,8 +15,8 @@ func AddTableAppState(x *xorm.Engine) error {
Revision int64
Content string `xorm:"LONGTEXT"`
}
if err := x.Sync2(new(AppState)); err != nil {
return fmt.Errorf("Sync2: %w", err)
if err := x.Sync(new(AppState)); err != nil {
return fmt.Errorf("Sync: %w", err)
}
return nil
}

View File

@@ -16,7 +16,7 @@ func CreateUserSettingsTable(x *xorm.Engine) error {
SettingKey string `xorm:"varchar(255) index unique(key_userid)"` // ensure key is always lowercase
SettingValue string `xorm:"text"`
}
if err := x.Sync2(new(UserSetting)); err != nil {
if err := x.Sync(new(UserSetting)); err != nil {
return fmt.Errorf("sync2: %w", err)
}
return nil

View File

@@ -13,5 +13,5 @@ func AddProjectIssueSorting(x *xorm.Engine) error {
Sorting int64 `xorm:"NOT NULL DEFAULT 0"`
}
return x.Sync2(new(ProjectIssue))
return x.Sync(new(ProjectIssue))
}

View File

@@ -10,5 +10,5 @@ func AddSSHKeyIsVerified(x *xorm.Engine) error {
Verified bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync2(new(PublicKey))
return x.Sync(new(PublicKey))
}

View File

@@ -18,7 +18,7 @@ func AddAuthorizeColForTeamUnit(x *xorm.Engine) error {
AccessMode int
}
if err := x.Sync2(new(TeamUnit)); err != nil {
if err := x.Sync(new(TeamUnit)); err != nil {
return fmt.Errorf("sync2: %w", err)
}

View File

@@ -34,7 +34,7 @@ func RemigrateU2FCredentials(x *xorm.Engine) error {
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}
if err := x.Sync2(&webauthnCredential{}); err != nil {
if err := x.Sync(&webauthnCredential{}); err != nil {
return err
}