Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

Merge branch 'feat/1.1.0/sql' into test

aichy12612a820e07f9f
diff --cc internal/migrations/v13.go
index 45c64ae7,65dcb3ae..0f18cd98
--- a/internal/migrations/v13.go
+++ b/internal/migrations/v13.go
@@@ -11,30 -8,18 +8,18 @@@ import
"xorm.io/xorm"
)
- func addGravatarBaseURL(x *xorm.Engine) error {
- usersSiteInfo := &entity.SiteInfo{
- Type: constant.SiteTypeUsers,
- }
- exist, err := x.Get(usersSiteInfo)
- if err != nil {
- return fmt.Errorf("get config failed: %w", err)
- }
- if exist {
- content := &schema.SiteUsersReq{}
- _ = json.Unmarshal([]byte(usersSiteInfo.Content), content)
- content.GravatarBaseURL = "https://www.gravatar.com/avatar/"
- data, _ := json.Marshal(content)
- usersSiteInfo.Content = string(data)
-
- _, err = x.ID(usersSiteInfo.ID).Cols("content").Update(usersSiteInfo)
- if err != nil {
- return fmt.Errorf("update site info failed: %w", err)
- }
- }
+ func updateCount(x *xorm.Engine) error {
+ // updateQuestionCount(x)
+ // updateTagCount(x)
+ // updateUserQuestionCount(x)
+ updateUserAnswerCount(x)
+ return nil
+ }
- //search all answers
+ func updateQuestionCount(x *xorm.Engine) error {
+ //question answer count
answers := make([]entity.Answer, 0)
- err := x.Find(&answers, &entity.Answer{Status: entity.AnswerStatusAvailable})
+ err = x.Find(&answers, &entity.Answer{Status: entity.AnswerStatusAvailable})
if err != nil {
return fmt.Errorf("get answers failed: %w", err)
}