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.

35 lines
952 B

  1. // Copyright 2017 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. "time"
  8. "github.com/go-xorm/core"
  9. "github.com/go-xorm/xorm"
  10. )
  11. func addLoginSourceSyncEnabledColumn(x *xorm.Engine) error {
  12. // LoginSource see models/login_source.go
  13. type LoginSource struct {
  14. ID int64 `xorm:"pk autoincr"`
  15. Type int
  16. Name string `xorm:"UNIQUE"`
  17. IsActived bool `xorm:"INDEX NOT NULL DEFAULT false"`
  18. IsSyncEnabled bool `xorm:"INDEX NOT NULL DEFAULT false"`
  19. Cfg core.Conversion `xorm:"TEXT"`
  20. Created time.Time `xorm:"-"`
  21. CreatedUnix int64 `xorm:"INDEX"`
  22. Updated time.Time `xorm:"-"`
  23. UpdatedUnix int64 `xorm:"INDEX"`
  24. }
  25. if err := x.Sync2(new(LoginSource)); err != nil {
  26. return fmt.Errorf("Sync2: %v", err)
  27. }
  28. return nil
  29. }