RepoIDint64`xorm:"INDEX"`// this should not be zero
IssueIDint64`xorm:"INDEX"`// maybe zero when creating
ReleaseIDint64`xorm:"INDEX"`// maybe zero when creating
UploaderIDint64`xorm:"INDEX DEFAULT 0"`
}
iferr:=x.Sync2(new(Attachment));err!=nil{
returnerr
}
if_,err:=x.Exec("UPDATE `attachment` set repo_id = (SELECT repo_id FROM `issue` WHERE `issue`.id = `attachment`.issue_id) WHERE `attachment`.issue_id > 0");err!=nil{
returnerr
}
if_,err:=x.Exec("UPDATE `attachment` set repo_id = (SELECT repo_id FROM `release` WHERE `release`.id = `attachment`.release_id) WHERE `attachment`.release_id > 0");err!=nil{