code.gitea.io/gitea@v1.21.7/models/migrations/v1_11/v106.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_11 //nolint
     5  
     6  import (
     7  	"xorm.io/xorm"
     8  )
     9  
    10  // RepoWatchMode specifies what kind of watch the user has on a repository
    11  type RepoWatchMode int8
    12  
    13  // Watch is connection request for receiving repository notification.
    14  type Watch struct {
    15  	ID   int64         `xorm:"pk autoincr"`
    16  	Mode RepoWatchMode `xorm:"SMALLINT NOT NULL DEFAULT 1"`
    17  }
    18  
    19  func AddModeColumnToWatch(x *xorm.Engine) error {
    20  	if err := x.Sync(new(Watch)); err != nil {
    21  		return err
    22  	}
    23  	_, err := x.Exec("UPDATE `watch` SET `mode` = 1")
    24  	return err
    25  }