This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 6a935de27c6ab2df7cf299ef3df0a2e74ce71795
Author: linyh <[email protected]>
AuthorDate: Thu Sep 15 18:33:30 2022 +0800

    feat: add index for cicd_pipeline_commits.repo
---
 models/migrationscripts/20220915_rename_pipeline_commits.go | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/models/migrationscripts/20220915_rename_pipeline_commits.go 
b/models/migrationscripts/20220915_rename_pipeline_commits.go
index 4350a7f0..5b8adb25 100644
--- a/models/migrationscripts/20220915_rename_pipeline_commits.go
+++ b/models/migrationscripts/20220915_rename_pipeline_commits.go
@@ -42,7 +42,7 @@ type CiCDPipelineRepo0915 struct {
        PipelineId string `gorm:"primaryKey;type:varchar(255)"`
        CommitSha  string `gorm:"primaryKey;type:varchar(255)"`
        Branch     string `gorm:"type:varchar(255)"`
-       Repo       string `gorm:"type:varchar(255)"`
+       Repo       string `gorm:"index;type:varchar(255)"`
 }
 
 func (CiCDPipelineRepo0915) TableName() string {
@@ -58,6 +58,15 @@ func (*renamePipelineCommits) Up(ctx context.Context, db 
*gorm.DB) errors.Error
        if err != nil {
                return errors.Convert(err)
        }
+       err = db.Migrator().RenameIndex(CiCDPipelineRepo0915{}, 
`idx_cicd_pipeline_repos_raw_data_params`, 
`idx_cicd_pipeline_commits_raw_data_params`)
+       if err != nil {
+               return errors.Convert(err)
+       }
+       // add index
+       err = db.Migrator().AutoMigrate(CiCDPipelineRepo0915{})
+       if err != nil {
+               return errors.Convert(err)
+       }
        return nil
 }
 

Reply via email to