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
The following commit(s) were added to refs/heads/main by this push:
new 4d9423c80 fix: create table _tool_gitlab_issue_assignees (#5373)
4d9423c80 is described below
commit 4d9423c805b53596e2b6ff128ba654b3351502a6
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Jun 6 16:27:32 2023 +0800
fix: create table _tool_gitlab_issue_assignees (#5373)
---
...{register.go => 20230606_add_issue_assignee.go} | 39 +++++++++++++---------
.../{register.go => archived/issue_assignee.go} | 31 ++++++++---------
.../gitlab/models/migrationscripts/register.go | 1 +
3 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go
b/backend/plugins/gitlab/models/migrationscripts/20230606_add_issue_assignee.go
similarity index 54%
copy from backend/plugins/gitlab/models/migrationscripts/register.go
copy to
backend/plugins/gitlab/models/migrationscripts/20230606_add_issue_assignee.go
index b39b8bba3..00c0ef1ed 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++
b/backend/plugins/gitlab/models/migrationscripts/20230606_add_issue_assignee.go
@@ -18,23 +18,30 @@ limitations under the License.
package migrationscripts
import (
- "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+
"github.com/apache/incubator-devlake/plugins/gitlab/models/migrationscripts/archived"
)
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
- return []plugin.MigrationScript{
- new(addInitTables),
- new(addGitlabCI),
- new(addPipelineID),
- new(addPipelineProjects),
- new(fixDurationToFloat8),
- new(addTransformationRule20221125),
- new(addStdTypeToIssue221230),
- new(addIsDetailRequired20230210),
- new(addConnectionIdToTransformationRule),
- new(addGitlabCommitAuthorInfo),
- new(addTypeEnvToPipeline),
- new(renameTr2ScopeConfig),
+type addGitlabIssueAssignee struct{}
+
+func (*addGitlabIssueAssignee) Up(baseRes context.BasicRes) errors.Error {
+ err := migrationhelper.AutoMigrateTables(
+ baseRes,
+ &archived.GitlabIssueAssignee{},
+ )
+ if err != nil {
+ return err
}
+
+ return nil
+}
+
+func (*addGitlabIssueAssignee) Version() uint64 {
+ return 20230606110339
+}
+
+func (*addGitlabIssueAssignee) Name() string {
+ return "add _tool_gitlab_issue_assignees table"
}
diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go
b/backend/plugins/gitlab/models/migrationscripts/archived/issue_assignee.go
similarity index 58%
copy from backend/plugins/gitlab/models/migrationscripts/register.go
copy to
backend/plugins/gitlab/models/migrationscripts/archived/issue_assignee.go
index b39b8bba3..41c04066d 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/archived/issue_assignee.go
@@ -15,26 +15,21 @@ See the License for the specific language governing
permissions and
limitations under the License.
*/
-package migrationscripts
+package archived
import (
- "github.com/apache/incubator-devlake/core/plugin"
+
"github.com/apache/incubator-devlake/core/models/migrationscripts/archived"
)
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
- return []plugin.MigrationScript{
- new(addInitTables),
- new(addGitlabCI),
- new(addPipelineID),
- new(addPipelineProjects),
- new(fixDurationToFloat8),
- new(addTransformationRule20221125),
- new(addStdTypeToIssue221230),
- new(addIsDetailRequired20230210),
- new(addConnectionIdToTransformationRule),
- new(addGitlabCommitAuthorInfo),
- new(addTypeEnvToPipeline),
- new(renameTr2ScopeConfig),
- }
+type GitlabIssueAssignee struct {
+ archived.NoPKModel
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GitlabId int `gorm:"primaryKey"`
+ ProjectId int `gorm:"primaryKey"`
+ AssigneeId int `gorm:"primaryKey"`
+ AssigneeName string `gorm:"type:varchar(255)"`
+}
+
+func (GitlabIssueAssignee) TableName() string {
+ return "_tool_gitlab_issue_assignees"
}
diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go
b/backend/plugins/gitlab/models/migrationscripts/register.go
index b39b8bba3..2ef9c9ede 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/register.go
@@ -36,5 +36,6 @@ func All() []plugin.MigrationScript {
new(addGitlabCommitAuthorInfo),
new(addTypeEnvToPipeline),
new(renameTr2ScopeConfig),
+ new(addGitlabIssueAssignee),
}
}