You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package migrations
  5. import (
  6. "fmt"
  7. "xorm.io/xorm"
  8. )
  9. func createUserSettingsTable(x *xorm.Engine) error {
  10. type UserSetting struct {
  11. ID int64 `xorm:"pk autoincr"`
  12. UserID int64 `xorm:"index unique(key_userid)"` // to load all of someone's settings
  13. SettingKey string `xorm:"varchar(255) index unique(key_userid)"` // ensure key is always lowercase
  14. SettingValue string `xorm:"text"`
  15. }
  16. if err := x.Sync2(new(UserSetting)); err != nil {
  17. return fmt.Errorf("sync2: %v", err)
  18. }
  19. return nil
  20. }