forked from gitea/gitea
Create system webhook column (and migration)
This commit is contained in:
parent
f9d34b2c60
commit
09dbd6be0d
|
@ -188,6 +188,8 @@ var migrations = []Migration{
|
||||||
NewMigration("Fix topic repository count", fixTopicRepositoryCount),
|
NewMigration("Fix topic repository count", fixTopicRepositoryCount),
|
||||||
// v127 -> v128
|
// v127 -> v128
|
||||||
NewMigration("add repository code language statistics", addLanguageStats),
|
NewMigration("add repository code language statistics", addLanguageStats),
|
||||||
|
// v128 -> v129
|
||||||
|
NewMigration("Add IsSystemWebhook column to webhooks table", addSystemWebhookColumn),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate database to current version
|
// Migrate database to current version
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func addSystemWebhookColumn(x *xorm.Engine) error {
|
||||||
|
type Webhook struct {
|
||||||
|
IsSystemWebhook bool `xorm:"NOT NULL DEFAULT 0"`
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := x.Sync2(new(Webhook)); err != nil {
|
||||||
|
return fmt.Errorf("Sync2: %v", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -90,21 +90,22 @@ const (
|
||||||
|
|
||||||
// Webhook represents a web hook object.
|
// Webhook represents a web hook object.
|
||||||
type Webhook struct {
|
type Webhook struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
RepoID int64 `xorm:"INDEX"`
|
RepoID int64 `xorm:"INDEX"` // An ID of 0 indicates either a default or system webhook
|
||||||
OrgID int64 `xorm:"INDEX"`
|
OrgID int64 `xorm:"INDEX"`
|
||||||
URL string `xorm:"url TEXT"`
|
IsSystemWebhook bool
|
||||||
Signature string `xorm:"TEXT"`
|
URL string `xorm:"url TEXT"`
|
||||||
HTTPMethod string `xorm:"http_method"`
|
Signature string `xorm:"TEXT"`
|
||||||
ContentType HookContentType
|
HTTPMethod string `xorm:"http_method"`
|
||||||
Secret string `xorm:"TEXT"`
|
ContentType HookContentType
|
||||||
Events string `xorm:"TEXT"`
|
Secret string `xorm:"TEXT"`
|
||||||
*HookEvent `xorm:"-"`
|
Events string `xorm:"TEXT"`
|
||||||
IsSSL bool `xorm:"is_ssl"`
|
*HookEvent `xorm:"-"`
|
||||||
IsActive bool `xorm:"INDEX"`
|
IsSSL bool `xorm:"is_ssl"`
|
||||||
HookTaskType HookTaskType
|
IsActive bool `xorm:"INDEX"`
|
||||||
Meta string `xorm:"TEXT"` // store hook-specific attributes
|
HookTaskType HookTaskType
|
||||||
LastStatus HookStatus // Last delivery status
|
Meta string `xorm:"TEXT"` // store hook-specific attributes
|
||||||
|
LastStatus HookStatus // Last delivery status
|
||||||
|
|
||||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
||||||
|
|
Loading…
Reference in New Issue