feat: add recommend and reserved tag field migration

This commit is contained in:
LinkinStar 2022-11-17 10:09:18 +08:00
parent 82130b70b1
commit f6095fd476
2 changed files with 14 additions and 0 deletions

View File

@ -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

13
internal/migrations/v2.go Normal file
View File

@ -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))
}