code.gitea.io/gitea@v1.21.7/models/migrations/v1_19/v234.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_19 //nolint
     5  
     6  import (
     7  	"code.gitea.io/gitea/modules/timeutil"
     8  
     9  	"xorm.io/xorm"
    10  )
    11  
    12  func CreatePackageCleanupRuleTable(x *xorm.Engine) error {
    13  	type PackageCleanupRule struct {
    14  		ID            int64              `xorm:"pk autoincr"`
    15  		Enabled       bool               `xorm:"INDEX NOT NULL DEFAULT false"`
    16  		OwnerID       int64              `xorm:"UNIQUE(s) INDEX NOT NULL DEFAULT 0"`
    17  		Type          string             `xorm:"UNIQUE(s) INDEX NOT NULL"`
    18  		KeepCount     int                `xorm:"NOT NULL DEFAULT 0"`
    19  		KeepPattern   string             `xorm:"NOT NULL DEFAULT ''"`
    20  		RemoveDays    int                `xorm:"NOT NULL DEFAULT 0"`
    21  		RemovePattern string             `xorm:"NOT NULL DEFAULT ''"`
    22  		MatchFullName bool               `xorm:"NOT NULL DEFAULT false"`
    23  		CreatedUnix   timeutil.TimeStamp `xorm:"created NOT NULL DEFAULT 0"`
    24  		UpdatedUnix   timeutil.TimeStamp `xorm:"updated NOT NULL DEFAULT 0"`
    25  	}
    26  
    27  	return x.Sync(new(PackageCleanupRule))
    28  }