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: add recommend and reserved tag field migration

LinkinStarf6095fd4769e
diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go
index 200e4813..da34800c 100644
--- a/internal/migrations/migrations.go
+++ b/internal/migrations/migrations.go
@@ -43,6 +43,7 @@ var migrations = []Migration{
// 0->1
NewMigration("this is first version, no operation", noopMigration),
NewMigration("add user language", addUserLanguage),
+ NewMigration("add recommend and reserved tag fields", addTagRecommendedAndReserved),
}
// GetCurrentDBVersion returns the current db version
diff --git a/internal/migrations/v2.go b/internal/migrations/v2.go
new file mode 100644
index 00000000..b006daf8
--- /dev/null
+++ b/internal/migrations/v2.go
@@ -0,0 +1,13 @@
+package migrations
+
+import (
+ "xorm.io/xorm"
+)
+
+func addTagRecommendedAndReserved(x *xorm.Engine) error {
+ type Tag struct {
+ Recommend bool `xorm:"not null default false BOOL recommend"`
+ Reserved bool `xorm:"not null default false BOOL reserved"`
+ }
+ return x.Sync(new(Tag))
+}