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.

feat: upgrade add migration config

LinkinStarba5243040e73
diff --git a/internal/migrations/v3.go b/internal/migrations/v3.go
index d7e68f10..d61de936 100644
--- a/internal/migrations/v3.go
+++ b/internal/migrations/v3.go
@@ -3,10 +3,38 @@ package migrations
import (
"time"
+ "github.com/answerdev/answer/internal/entity"
"xorm.io/xorm"
)
func addActivityTimeline(x *xorm.Engine) error {
+ defaultConfigTable := []*entity.Config{
+ {ID: 87, Key: "question.asked", Value: `0`},
+ {ID: 88, Key: "question.closed", Value: `0`},
+ {ID: 89, Key: "question.reopened", Value: `0`},
+ {ID: 90, Key: "question.answered", Value: `0`},
+ {ID: 91, Key: "question.commented", Value: `0`},
+ {ID: 92, Key: "question.accept", Value: `0`},
+ {ID: 93, Key: "question.edited", Value: `0`},
+ {ID: 94, Key: "question.rollback", Value: `0`},
+ {ID: 95, Key: "question.deleted", Value: `0`},
+ {ID: 96, Key: "question.undeleted", Value: `0`},
+ {ID: 97, Key: "answer.answered", Value: `0`},
+ {ID: 98, Key: "answer.commented", Value: `0`},
+ {ID: 99, Key: "answer.edited", Value: `0`},
+ {ID: 100, Key: "answer.rollback", Value: `0`},
+ {ID: 101, Key: "answer.undeleted", Value: `0`},
+ {ID: 102, Key: "tag.created", Value: `0`},
+ {ID: 103, Key: "tag.edited", Value: `0`},
+ {ID: 104, Key: "tag.rollback", Value: `0`},
+ {ID: 105, Key: "tag.deleted", Value: `0`},
+ {ID: 106, Key: "tag.undeleted", Value: `0`},
+ }
+ _, err := x.Insert(defaultConfigTable)
+ if err != nil {
+ return err
+ }
+
type Revision struct {
ReviewUserID int64 `xorm:"not null default 0 BIGINT(20) review_user_id"`
}