You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/09/07 12:25:57 UTC

[incubator-devlake] branch main updated (cd397fda -> 4d674d08)

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

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


    from cd397fda fix(code generator): modify template
     new 71cc511c fix: add pipeline_projects_tables and fix common import
     new a657a0ff fix: add pipeline_projects_tables and fix common import and fix pipelineRelationship primaryKey
     new 4d674d08 fix: add pipeline_projects_tables and fix common import and fix pipelineRelationship primaryKey

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 models/domainlayer/devops/cicd_pipeline.go         |  4 +-
 .../20220905_modfiy_cicd_pipeline.go               |  5 +-
 .../migrationscripts/20220729_modify_gilab_ci.go   |  6 +--
 .../migrationscripts/20220804_add_pipeline_id.go   |  4 +-
 .../20220907_add_pipeline_projects_tables.go}      | 53 ++++++++++------------
 plugins/gitlab/models/migrationscripts/register.go |  1 +
 6 files changed, 35 insertions(+), 38 deletions(-)
 copy plugins/gitlab/models/{pipeline.go => migrationscripts/20220907_add_pipeline_projects_tables.go} (58%)


[incubator-devlake] 03/03: fix: add pipeline_projects_tables and fix common import and fix pipelineRelationship primaryKey

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4d674d089992bd712cce8265bc791b5784d1a8e3
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed Sep 7 16:27:48 2022 +0800

    fix: add pipeline_projects_tables and fix common import and fix pipelineRelationship primaryKey
---
 .../20220905_modfiy_cicd_pipeline.go               | 34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/models/migrationscripts/20220905_modfiy_cicd_pipeline.go b/models/migrationscripts/20220905_modfiy_cicd_pipeline.go
index 7b28edc5..934f261c 100644
--- a/models/migrationscripts/20220905_modfiy_cicd_pipeline.go
+++ b/models/migrationscripts/20220905_modfiy_cicd_pipeline.go
@@ -27,23 +27,23 @@ import (
 type modifyPipeline struct{}
 
 func (*modifyPipeline) Up(ctx context.Context, db *gorm.DB) error {
-	// err := db.Migrator().DropColumn(CICDPipeline0905{}, "commit_sha")
-	// if err != nil {
-	// 	return err
-	// }
-	// err = db.Migrator().DropColumn(CICDPipeline0905{}, "branch")
-	// if err != nil {
-	// 	return err
-	// }
-	// err = db.Migrator().DropColumn(CICDPipeline0905{}, "repo")
-	// if err != nil {
-	// 	return err
-	// }
-	// err = db.Migrator().RenameColumn(CICDPipelineRepo0905{}, "repo_url", "repo")
-	// if err != nil {
-	// 	return err
-	// }
-	err := db.Migrator().AutoMigrate(CICDPipelineRelationship0905{})
+	err := db.Migrator().DropColumn(CICDPipeline0905{}, "commit_sha")
+	if err != nil {
+		return err
+	}
+	err = db.Migrator().DropColumn(CICDPipeline0905{}, "branch")
+	if err != nil {
+		return err
+	}
+	err = db.Migrator().DropColumn(CICDPipeline0905{}, "repo")
+	if err != nil {
+		return err
+	}
+	err = db.Migrator().RenameColumn(CICDPipelineRepo0905{}, "repo_url", "repo")
+	if err != nil {
+		return err
+	}
+	err = db.Migrator().AutoMigrate(CICDPipelineRelationship0905{})
 	if err != nil {
 		return err
 	}


[incubator-devlake] 01/03: fix: add pipeline_projects_tables and fix common import

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 71cc511c7087789700df0758ee8b85f4f1555fbc
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed Sep 7 16:02:07 2022 +0800

    fix: add pipeline_projects_tables and fix common import
---
 .../migrationscripts/20220729_modify_gilab_ci.go   |  6 +--
 .../migrationscripts/20220804_add_pipeline_id.go   |  4 +-
 .../20220907_add_pipeline_projects_tables.go       | 56 ++++++++++++++++++++++
 plugins/gitlab/models/migrationscripts/register.go |  1 +
 4 files changed, 62 insertions(+), 5 deletions(-)

diff --git a/plugins/gitlab/models/migrationscripts/20220729_modify_gilab_ci.go b/plugins/gitlab/models/migrationscripts/20220729_modify_gilab_ci.go
index 709c6ebd..b99e3cc4 100644
--- a/plugins/gitlab/models/migrationscripts/20220729_modify_gilab_ci.go
+++ b/plugins/gitlab/models/migrationscripts/20220729_modify_gilab_ci.go
@@ -21,7 +21,7 @@ import (
 	"context"
 	"time"
 
-	"github.com/apache/incubator-devlake/models/common"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
 	"gorm.io/gorm"
 )
 
@@ -44,7 +44,7 @@ type GitlabPipeline20220729 struct {
 	FinishedAt      *time.Time
 	Coverage        string
 
-	common.NoPKModel
+	archived.NoPKModel
 }
 
 func (GitlabPipeline20220729) TableName() string {
@@ -69,7 +69,7 @@ type GitlabJob20220729 struct {
 	StartedAt       *time.Time
 	FinishedAt      *time.Time
 
-	common.NoPKModel
+	archived.NoPKModel
 }
 
 func (GitlabJob20220729) TableName() string {
diff --git a/plugins/gitlab/models/migrationscripts/20220804_add_pipeline_id.go b/plugins/gitlab/models/migrationscripts/20220804_add_pipeline_id.go
index 5dae2a16..c9e018e2 100644
--- a/plugins/gitlab/models/migrationscripts/20220804_add_pipeline_id.go
+++ b/plugins/gitlab/models/migrationscripts/20220804_add_pipeline_id.go
@@ -21,7 +21,7 @@ import (
 	"context"
 	"time"
 
-	"github.com/apache/incubator-devlake/models/common"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
 	"gorm.io/gorm"
 )
 
@@ -46,7 +46,7 @@ type GitlabJob20220804 struct {
 	StartedAt       *time.Time
 	FinishedAt      *time.Time
 
-	common.NoPKModel
+	archived.NoPKModel
 }
 
 func (GitlabJob20220804) TableName() string {
diff --git a/plugins/gitlab/models/migrationscripts/20220907_add_pipeline_projects_tables.go b/plugins/gitlab/models/migrationscripts/20220907_add_pipeline_projects_tables.go
new file mode 100644
index 00000000..bd2440a8
--- /dev/null
+++ b/plugins/gitlab/models/migrationscripts/20220907_add_pipeline_projects_tables.go
@@ -0,0 +1,56 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"context"
+
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"gorm.io/gorm"
+)
+
+type addPipelineProjects struct{}
+
+type GitlabPipelineProjects20220907 struct {
+	ConnectionId uint64 `gorm:"primaryKey"`
+	PipelineId   int    `gorm:"primaryKey"`
+	ProjectId    int    `gorm:"primaryKey;type:varchar(255)"`
+	Ref          string `gorm:"type:varchar(255)"`
+	Sha          string `gorm:"type:varchar(255)"`
+	archived.NoPKModel
+}
+
+func (GitlabPipelineProjects20220907) TableName() string {
+	return "_tool_gitlab_pipeline_projects"
+}
+
+func (*addPipelineProjects) Up(ctx context.Context, db *gorm.DB) error {
+	err := db.Migrator().CreateTable(&GitlabPipelineProjects20220907{})
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+func (*addPipelineProjects) Version() uint64 {
+	return 20220907230912
+}
+
+func (*addPipelineProjects) Name() string {
+	return "gitlab add _tool_gitlab_pipeline_projects table"
+}
diff --git a/plugins/gitlab/models/migrationscripts/register.go b/plugins/gitlab/models/migrationscripts/register.go
index 72d78239..f349677e 100644
--- a/plugins/gitlab/models/migrationscripts/register.go
+++ b/plugins/gitlab/models/migrationscripts/register.go
@@ -27,5 +27,6 @@ func All() []migration.Script {
 		new(addInitTables),
 		new(modifyGitlabCI),
 		new(addPipelineID),
+		new(addPipelineProjects),
 	}
 }


[incubator-devlake] 02/03: fix: add pipeline_projects_tables and fix common import and fix pipelineRelationship primaryKey

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a657a0ff3a497d8a1f1c4b1834822a38660f3423
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed Sep 7 16:26:48 2022 +0800

    fix: add pipeline_projects_tables and fix common import and fix pipelineRelationship primaryKey
---
 models/domainlayer/devops/cicd_pipeline.go         |  4 +--
 .../20220905_modfiy_cicd_pipeline.go               | 39 +++++++++++-----------
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/models/domainlayer/devops/cicd_pipeline.go b/models/domainlayer/devops/cicd_pipeline.go
index 241abcd3..cb3b5a80 100644
--- a/models/domainlayer/devops/cicd_pipeline.go
+++ b/models/domainlayer/devops/cicd_pipeline.go
@@ -24,8 +24,8 @@ func (CICDPipeline) TableName() string {
 }
 
 type CICDPipelineRelationship struct {
-	ParentPipelineId string `gorm:"primary;type:varchar(255)"`
-	ChildPipelineId  string `gorm:"primary;type:varchar(255)"`
+	ParentPipelineId string `gorm:"primaryKey;type:varchar(255)"`
+	ChildPipelineId  string `gorm:"primaryKey;type:varchar(255)"`
 	common.NoPKModel
 }
 
diff --git a/models/migrationscripts/20220905_modfiy_cicd_pipeline.go b/models/migrationscripts/20220905_modfiy_cicd_pipeline.go
index 744f940e..7b28edc5 100644
--- a/models/migrationscripts/20220905_modfiy_cicd_pipeline.go
+++ b/models/migrationscripts/20220905_modfiy_cicd_pipeline.go
@@ -19,6 +19,7 @@ package migrationscripts
 
 import (
 	"context"
+
 	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
 	"gorm.io/gorm"
 )
@@ -26,23 +27,23 @@ import (
 type modifyPipeline struct{}
 
 func (*modifyPipeline) Up(ctx context.Context, db *gorm.DB) error {
-	err := db.Migrator().DropColumn(CICDPipeline0905{}, "commit_sha")
-	if err != nil {
-		return err
-	}
-	err = db.Migrator().DropColumn(CICDPipeline0905{}, "branch")
-	if err != nil {
-		return err
-	}
-	err = db.Migrator().DropColumn(CICDPipeline0905{}, "repo")
-	if err != nil {
-		return err
-	}
-	err = db.Migrator().RenameColumn(CICDPipelineRepo0905{}, "repo_url", "repo")
-	if err != nil {
-		return err
-	}
-	err = db.Migrator().AutoMigrate(CICDPipelineRelationship0905{})
+	// err := db.Migrator().DropColumn(CICDPipeline0905{}, "commit_sha")
+	// if err != nil {
+	// 	return err
+	// }
+	// err = db.Migrator().DropColumn(CICDPipeline0905{}, "branch")
+	// if err != nil {
+	// 	return err
+	// }
+	// err = db.Migrator().DropColumn(CICDPipeline0905{}, "repo")
+	// if err != nil {
+	// 	return err
+	// }
+	// err = db.Migrator().RenameColumn(CICDPipelineRepo0905{}, "repo_url", "repo")
+	// if err != nil {
+	// 	return err
+	// }
+	err := db.Migrator().AutoMigrate(CICDPipelineRelationship0905{})
 	if err != nil {
 		return err
 	}
@@ -76,8 +77,8 @@ func (CICDPipelineRepo0905) TableName() string {
 }
 
 type CICDPipelineRelationship0905 struct {
-	ParentPipelineId string `gorm:"primary;type:varchar(255)"`
-	ChildPipelineId  string `gorm:"primary;type:varchar(255)"`
+	ParentPipelineId string `gorm:"primaryKey;type:varchar(255)"`
+	ChildPipelineId  string `gorm:"primaryKey;type:varchar(255)"`
 	archived.NoPKModel
 }