code.gitea.io/gitea@v1.21.7/models/migrations/v1_21/v273.go (about)

     1  // Copyright 2023 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_21 //nolint
     5  import (
     6  	"code.gitea.io/gitea/modules/timeutil"
     7  
     8  	"xorm.io/xorm"
     9  )
    10  
    11  func AddActionScheduleTable(x *xorm.Engine) error {
    12  	type ActionSchedule struct {
    13  		ID            int64
    14  		Title         string
    15  		Specs         []string
    16  		RepoID        int64 `xorm:"index"`
    17  		OwnerID       int64 `xorm:"index"`
    18  		WorkflowID    string
    19  		TriggerUserID int64
    20  		Ref           string
    21  		CommitSHA     string
    22  		Event         string
    23  		EventPayload  string `xorm:"LONGTEXT"`
    24  		Content       []byte
    25  		Created       timeutil.TimeStamp `xorm:"created"`
    26  		Updated       timeutil.TimeStamp `xorm:"updated"`
    27  	}
    28  
    29  	type ActionScheduleSpec struct {
    30  		ID         int64
    31  		RepoID     int64 `xorm:"index"`
    32  		ScheduleID int64 `xorm:"index"`
    33  		Spec       string
    34  		Next       timeutil.TimeStamp `xorm:"index"`
    35  		Prev       timeutil.TimeStamp
    36  
    37  		Created timeutil.TimeStamp `xorm:"created"`
    38  		Updated timeutil.TimeStamp `xorm:"updated"`
    39  	}
    40  
    41  	return x.Sync(
    42  		new(ActionSchedule),
    43  		new(ActionScheduleSpec),
    44  	)
    45  }