code.gitea.io/gitea@v1.22.3/models/migrations/v1_22/v289.go (about)

     1  // Copyright 2024 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_22 //nolint
     5  
     6  import "xorm.io/xorm"
     7  
     8  func AddDefaultWikiBranch(x *xorm.Engine) error {
     9  	type Repository struct {
    10  		ID                int64
    11  		DefaultWikiBranch string
    12  	}
    13  	if err := x.Sync(&Repository{}); err != nil {
    14  		return err
    15  	}
    16  	_, err := x.Exec("UPDATE `repository` SET default_wiki_branch = 'master' WHERE (default_wiki_branch IS NULL) OR (default_wiki_branch = '')")
    17  	return err
    18  }