From 57de44694c663c50a209effeffd9615be81f7550 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 14 Sep 2023 12:13:06 +0200 Subject: [PATCH] feat(webhooks): add index on project id --- pkg/migration/20230913202615.go | 2 +- pkg/models/webhooks.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/migration/20230913202615.go b/pkg/migration/20230913202615.go index 1df44f1e91b..f96badbede2 100644 --- a/pkg/migration/20230913202615.go +++ b/pkg/migration/20230913202615.go @@ -26,7 +26,7 @@ type webhooks20230913202615 struct { ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"webhook"` TargetURL string `xorm:"not null" valid:"minstringlength(1)" minLength:"1" json:"target_url"` Events []string `xorm:"JSON not null" valid:"minstringlength(1)" minLength:"1" json:"event"` - ProjectID int64 `xorm:"not null" json:"project_id" param:"project"` + ProjectID int64 `xorm:"bigint not null index" json:"project_id" param:"project"` CreatedByID int64 `xorm:"bigint not null" json:"-"` Created time.Time `xorm:"created not null" json:"created"` Updated time.Time `xorm:"updated not null" json:"updated"` diff --git a/pkg/models/webhooks.go b/pkg/models/webhooks.go index f3a99e4c7b4..f81f3962e13 100644 --- a/pkg/models/webhooks.go +++ b/pkg/models/webhooks.go @@ -29,7 +29,7 @@ type Webhook struct { ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"webhook"` TargetURL string `xorm:"not null" valid:"minstringlength(1)" minLength:"1" json:"target_url"` Events []string `xorm:"JSON not null" valid:"minstringlength(1)" minLength:"1" json:"event"` - ProjectID int64 `xorm:"not null" json:"project_id" param:"project"` + ProjectID int64 `xorm:"bigint not null index" json:"project_id" param:"project"` // The user who initially created the webhook target. CreatedBy *user.User `xorm:"-" json:"created_by" valid:"-"`