mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:49:52 +01:00
Upgrade xorm to v1.3.9 and improve some migrations Sync (#29899)
Co-authored-by: 6543 <6543@obermui.de> (cherry picked from commit 0d08bb6112884411eb4f58b056278d3c824a8fc0)
This commit is contained in:
parent
d0227c236a
commit
54f2dcff9d
7 changed files with 36 additions and 7 deletions
|
@ -12,5 +12,9 @@ func AddIndexToActionUserID(x *xorm.Engine) error {
|
|||
UserID int64 `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
return x.Sync(new(Action))
|
||||
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreDropIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, new(Action))
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -10,5 +10,9 @@ func AddIgnoreStaleApprovalsColumnToProtectedBranchTable(x *xorm.Engine) error {
|
|||
type ProtectedBranch struct {
|
||||
IgnoreStaleApprovals bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
return x.Sync(new(ProtectedBranch))
|
||||
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, new(ProtectedBranch))
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -14,5 +14,9 @@ func AddPreviousDurationToActionRun(x *xorm.Engine) error {
|
|||
PreviousDuration time.Duration
|
||||
}
|
||||
|
||||
return x.Sync(&ActionRun{})
|
||||
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, &ActionRun{})
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -54,7 +54,10 @@ func addObjectFormatNameToRepository(x *xorm.Engine) error {
|
|||
ObjectFormatName string `xorm:"VARCHAR(6) NOT NULL DEFAULT 'sha1'"`
|
||||
}
|
||||
|
||||
if err := x.Sync(new(Repository)); err != nil {
|
||||
if _, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, new(Repository)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,10 @@ func AddDefaultWikiBranch(x *xorm.Engine) error {
|
|||
ID int64
|
||||
DefaultWikiBranch string
|
||||
}
|
||||
if err := x.Sync(&Repository{}); err != nil {
|
||||
if _, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, &Repository{}); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := x.Exec("UPDATE `repository` SET default_wiki_branch = 'master' WHERE (default_wiki_branch IS NULL) OR (default_wiki_branch = '')")
|
||||
|
|
|
@ -35,5 +35,12 @@ type HookTask struct {
|
|||
|
||||
func AddPayloadVersionToHookTaskTable(x *xorm.Engine) error {
|
||||
// create missing column
|
||||
return x.Sync(new(HookTask))
|
||||
if _, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, new(HookTask)); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := x.Exec("UPDATE hook_task SET payload_version = 1 WHERE payload_version IS NULL")
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -10,5 +10,9 @@ func AddCommentIDIndexofAttachment(x *xorm.Engine) error {
|
|||
CommentID int64 `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
return x.Sync(&Attachment{})
|
||||
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
IgnoreDropIndices: true,
|
||||
IgnoreConstrains: true,
|
||||
}, &Attachment{})
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue