This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 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 7f682b5e feat: update domain layer migration (#2445)
7f682b5e is described below
commit 7f682b5eccc8cde7228b58ebff51e2830c9f3b45
Author: abeizn <[email protected]>
AuthorDate: Fri Jul 8 20:30:25 2022 +0800
feat: update domain layer migration (#2445)
* feat: update domain layer migration
* feat: update domain layer migration
* feat: update domain layer migration
---
.../ticket/{changelog.go => issue_changelog.go} | 6 +-
.../220622-blueprint-normal-mode.go | 69 --------------
.../archived/{changelog.go => account.go} | 25 ++---
models/migrationscripts/archived/blueprint.go | 21 ++++-
models/migrationscripts/archived/board.go | 16 ++++
models/migrationscripts/archived/build.go | 4 +
models/migrationscripts/archived/commit.go | 18 +++-
models/migrationscripts/archived/issue.go | 32 ++++++-
.../issue_changelog.go} | 28 +-----
models/migrationscripts/archived/issue_history.go | 58 ------------
.../archived/issue_repo_commits.go | 4 +
models/migrationscripts/archived/job.go | 4 +
models/migrationscripts/archived/note.go | 6 +-
models/migrationscripts/archived/notification.go | 4 +
models/migrationscripts/archived/pipeline.go | 35 ++++---
models/migrationscripts/archived/pull_request.go | 51 +++++++---
models/migrationscripts/archived/ref.go | 23 ++++-
models/migrationscripts/archived/repo.go | 14 ++-
models/migrationscripts/archived/sprint.go | 23 +++--
models/migrationscripts/archived/task.go | 59 +++++++++---
.../migrationscripts/archived/{job.go => team.go} | 11 ++-
.../archived/{job.go => team_user.go} | 10 +-
models/migrationscripts/archived/user.go | 10 +-
.../archived/{job.go => user_account.go} | 10 +-
models/migrationscripts/archived/worklog.go | 4 +
models/migrationscripts/init_schema.go | 57 +++++++++--
models/migrationscripts/register.go | 9 --
models/migrationscripts/updateSchemas20220505.go | 42 ---------
models/migrationscripts/updateSchemas20220507.go | 75 ---------------
models/migrationscripts/updateSchemas20220510.go | 47 ----------
models/migrationscripts/updateSchemas20220513.go | 102 --------------------
models/migrationscripts/updateSchemas20220524.go | 51 ----------
models/migrationscripts/updateSchemas20220526.go | 75 ---------------
models/migrationscripts/updateSchemas20220527.go | 68 --------------
models/migrationscripts/updateSchemas20220528.go | 72 --------------
models/migrationscripts/updateSchemas20220601.go | 68 --------------
models/migrationscripts/updateSchemas20220602.go | 39 --------
models/migrationscripts/updateSchemas20220612.go | 48 ----------
models/migrationscripts/updateSchemas20220613.go | 78 ----------------
models/migrationscripts/updateSchemas20220614.go | 73 ---------------
models/migrationscripts/updateSchemas20220616.go | 53 -----------
models/migrationscripts/updateSchemas20220630.go | 60 ------------
models/migrationscripts/updateSchemas20220704.go | 50 ----------
models/migrationscripts/updateSchemas20220705.go | 104 ---------------------
plugins/jira/e2e/changelog_test.go | 6 +-
plugins/jira/tasks/issue_changelog_convertor.go | 2 +-
plugins/tapd/e2e/bug_changelog_test.go | 6 +-
plugins/tapd/e2e/story_changelog_test.go | 6 +-
plugins/tapd/tasks/bug_changelog_converter.go | 2 +-
plugins/tapd/tasks/story_changelog_converter.go | 2 +-
plugins/tapd/tasks/task_changelog_converter.go | 2 +-
51 files changed, 373 insertions(+), 1369 deletions(-)
diff --git a/models/domainlayer/ticket/changelog.go
b/models/domainlayer/ticket/issue_changelog.go
similarity index 92%
rename from models/domainlayer/ticket/changelog.go
rename to models/domainlayer/ticket/issue_changelog.go
index f16eba1d..e3b809cf 100644
--- a/models/domainlayer/ticket/changelog.go
+++ b/models/domainlayer/ticket/issue_changelog.go
@@ -23,7 +23,7 @@ import (
"github.com/apache/incubator-devlake/models/domainlayer"
)
-type Changelog struct {
+type IssueChangelogs struct {
domainlayer.DomainEntity
// collected fields
@@ -39,6 +39,6 @@ type Changelog struct {
CreatedDate time.Time
}
-func (Changelog) TableName() string {
- return "changelogs"
+func (IssueChangelogs) TableName() string {
+ return "issue_changelogs"
}
diff --git a/models/migrationscripts/220622-blueprint-normal-mode.go
b/models/migrationscripts/220622-blueprint-normal-mode.go
deleted file mode 100644
index 7ba66253..00000000
--- a/models/migrationscripts/220622-blueprint-normal-mode.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-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"
-
- "gorm.io/datatypes"
- "gorm.io/gorm"
-)
-
-// model blueprint
-type blueprintNormalMode_Blueprint struct {
- Settings datatypes.JSON `json:"settings"`
-}
-
-func (blueprintNormalMode_Blueprint) TableName() string {
- return "_devlake_blueprints"
-}
-
-// model pipeline
-type blueprintNormalMode_Pipeline struct {
-}
-
-func (blueprintNormalMode_Pipeline) TableName() string {
- return "_devlake_pipelines"
-}
-
-// migration script
-type blueprintNormalMode struct{}
-
-func (*blueprintNormalMode) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().AutoMigrate(&blueprintNormalMode_Blueprint{})
- if err != nil {
- return err
- }
- err = db.Migrator().RenameColumn(&blueprintNormalMode_Blueprint{},
"tasks", "plan")
- if err != nil {
- return err
- }
- err = db.Migrator().RenameColumn(&blueprintNormalMode_Pipeline{},
"tasks", "plan")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*blueprintNormalMode) Version() uint64 {
- return 20220622110537
-}
-
-func (*blueprintNormalMode) Name() string {
- return "blueprint normal mode support"
-}
diff --git a/models/migrationscripts/archived/changelog.go
b/models/migrationscripts/archived/account.go
similarity index 67%
rename from models/migrationscripts/archived/changelog.go
rename to models/migrationscripts/archived/account.go
index fffa12e9..3c643ede 100644
--- a/models/migrationscripts/archived/changelog.go
+++ b/models/migrationscripts/archived/account.go
@@ -17,18 +17,19 @@ limitations under the License.
package archived
-import (
- "time"
-)
+import "time"
-type Changelog struct {
+type Account struct {
DomainEntity
- IssueId string `gorm:"index;type:varchar(255)"`
- AuthorId string `gorm:"type:varchar(255)"`
- AuthorName string `gorm:"type:varchar(255)"`
- FieldId string `gorm:"type:varchar(255)"`
- FieldName string `gorm:"type:varchar(255)"`
- From string
- To string
- CreatedDate time.Time
+ Email string `gorm:"type:varchar(255)"`
+ FullName string `gorm:"type:varchar(255)"`
+ UserName string `gorm:"type:varchar(255)"`
+ AvatarUrl string `gorm:"type:varchar(255)"`
+ Organization string `gorm:"type:varchar(255)"`
+ CreatedDate *time.Time
+ Status int
+}
+
+func (Account) TableName() string {
+ return "accounts"
}
diff --git a/models/migrationscripts/archived/blueprint.go
b/models/migrationscripts/archived/blueprint.go
index a7e18d85..42822433 100644
--- a/models/migrationscripts/archived/blueprint.go
+++ b/models/migrationscripts/archived/blueprint.go
@@ -18,17 +18,30 @@ limitations under the License.
package archived
import (
+ "encoding/json"
+
"gorm.io/datatypes"
)
+const BLUEPRINT_MODE_NORMAL = "NORMAL"
+const BLUEPRINT_MODE_ADVANCED = "ADVANCED"
+
type Blueprint struct {
- Name string
- Tasks datatypes.JSON
- Enable bool
- CronConfig string
+ Name string `json:"name" validate:"required"`
+ Mode string `json:"mode" gorm:"varchar(20)"
validate:"required,oneof=NORMAL ADVANCED"`
+ Plan datatypes.JSON `json:"plan"`
+ Enable bool `json:"enable"`
+ CronConfig string `json:"cronConfig"`
+ IsManual bool `json:"isManual"`
+ Settings datatypes.JSON `json:"settings"`
Model
}
func (Blueprint) TableName() string {
return "_devlake_blueprints"
}
+
+type BlueprintSettings struct {
+ Version string `json:"version"
validate:"required,semver,oneof=1.0.0"`
+ Connections json.RawMessage `json:"connections" validate:"required"`
+}
diff --git a/models/migrationscripts/archived/board.go
b/models/migrationscripts/archived/board.go
index 1f2a2473..51424cd9 100644
--- a/models/migrationscripts/archived/board.go
+++ b/models/migrationscripts/archived/board.go
@@ -29,19 +29,35 @@ type Board struct {
CreatedDate *time.Time
}
+func (Board) TableName() string {
+ return "boards"
+}
+
type BoardSprint struct {
NoPKModel
BoardId string `gorm:"primaryKey;type:varchar(255)"`
SprintId string `gorm:"primaryKey;type:varchar(255)"`
}
+func (BoardSprint) TableName() string {
+ return "board_sprints"
+}
+
type BoardIssue struct {
BoardId string `gorm:"primaryKey;type:varchar(255)"`
IssueId string `gorm:"primaryKey;type:varchar(255)"`
NoPKModel
}
+func (BoardIssue) TableName() string {
+ return "board_issues"
+}
+
type BoardRepo struct {
BoardId string `gorm:"primaryKey;type:varchar(255)"`
RepoId string `gorm:"primaryKey;type:varchar(255)"`
}
+
+func (BoardRepo) TableName() string {
+ return "board_repos"
+}
diff --git a/models/migrationscripts/archived/build.go
b/models/migrationscripts/archived/build.go
index 12ac49f8..0a1d7cc1 100644
--- a/models/migrationscripts/archived/build.go
+++ b/models/migrationscripts/archived/build.go
@@ -30,3 +30,7 @@ type Build struct {
Status string `gorm:"type:varchar(100)"`
StartedDate time.Time
}
+
+func (Build) TableName() string {
+ return "builds"
+}
diff --git a/models/migrationscripts/archived/commit.go
b/models/migrationscripts/archived/commit.go
index e05b18a7..45ebca48 100644
--- a/models/migrationscripts/archived/commit.go
+++ b/models/migrationscripts/archived/commit.go
@@ -24,9 +24,9 @@ import (
type Commit struct {
NoPKModel
Sha string `json:"sha"
gorm:"primaryKey;type:varchar(40);comment:commit hash"`
- Additions int `gorm:"comment:Added lines of code"`
- Deletions int `gorm:"comment:Deleted lines of code"`
- DevEq int `gorm:"comment:Merico developer equivalent from
analysis engine"`
+ Additions int `json:"additions" gorm:"comment:Added lines of
code"`
+ Deletions int `json:"deletions" gorm:"comment:Deleted lines of
code"`
+ DevEq int `json:"deveq" gorm:"comment:Merico developer
equivalent from analysis engine"`
Message string
AuthorName string `gorm:"type:varchar(255)"`
AuthorEmail string `gorm:"type:varchar(255)"`
@@ -38,6 +38,10 @@ type Commit struct {
CommitterId string `gorm:"index;type:varchar(255)"`
}
+func (Commit) TableName() string {
+ return "commits"
+}
+
type CommitFile struct {
NoPKModel
CommitSha string `gorm:"primaryKey;type:varchar(40)"`
@@ -46,7 +50,15 @@ type CommitFile struct {
Deletions int
}
+func (CommitFile) TableName() string {
+ return "commit_files"
+}
+
type CommitParent struct {
CommitSha string `json:"commitSha"
gorm:"primaryKey;type:varchar(40);comment:commit hash"`
ParentCommitSha string `json:"parentCommitSha"
gorm:"primaryKey;type:varchar(40);comment:parent commit hash"`
}
+
+func (CommitParent) TableName() string {
+ return "commit_parents"
+}
diff --git a/models/migrationscripts/archived/issue.go
b/models/migrationscripts/archived/issue.go
index b0589613..24830fb6 100644
--- a/models/migrationscripts/archived/issue.go
+++ b/models/migrationscripts/archived/issue.go
@@ -21,17 +21,28 @@ import (
"time"
)
+const (
+ BUG = "BUG"
+ REQUIREMENT = "REQUIREMENT"
+ INCIDENT = "INCIDENT"
+
+ TODO = "TODO"
+ DONE = "DONE"
+ IN_PROGRESS = "IN_PROGRESS"
+)
+
type Issue struct {
DomainEntity
Url string `gorm:"type:varchar(255)"`
- Number string `gorm:"type:varchar(255)"`
+ IconURL string
`gorm:"type:varchar(255);column:icon_url"`
+ IssueKey string `gorm:"type:varchar(255)"`
Title string
Description string
EpicKey string `gorm:"type:varchar(255)"`
Type string `gorm:"type:varchar(100)"`
Status string `gorm:"type:varchar(100)"`
OriginalStatus string `gorm:"type:varchar(100)"`
- StoryPoint uint
+ StoryPoint int64
ResolutionDate *time.Time
CreatedDate *time.Time
UpdatedDate *time.Time
@@ -42,24 +53,37 @@ type Issue struct {
TimeSpentMinutes int64
TimeRemainingMinutes int64
CreatorId string `gorm:"type:varchar(255)"`
+ CreatorName string `gorm:"type:varchar(255)"`
AssigneeId string `gorm:"type:varchar(255)"`
AssigneeName string `gorm:"type:varchar(255)"`
Severity string `gorm:"type:varchar(255)"`
Component string `gorm:"type:varchar(255)"`
}
+func (Issue) TableName() string {
+ return "issues"
+}
+
type IssueCommit struct {
NoPKModel
IssueId string `gorm:"primaryKey;type:varchar(255)"`
CommitSha string `gorm:"primaryKey;type:varchar(255)"`
}
+func (IssueCommit) TableName() string {
+ return "issue_commits"
+}
+
type IssueLabel struct {
IssueId string `json:"id"
gorm:"primaryKey;type:varchar(255);comment:This key is generated based on
details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
LabelName string `gorm:"primaryKey;type:varchar(255)"`
NoPKModel
}
+func (IssueLabel) TableName() string {
+ return "issue_labels"
+}
+
type IssueComment struct {
DomainEntity
IssueId string `gorm:"index"`
@@ -67,3 +91,7 @@ type IssueComment struct {
UserId string `gorm:"type:varchar(255)"`
CreatedDate time.Time
}
+
+func (IssueComment) TableName() string {
+ return "issue_comments"
+}
diff --git a/models/migrationscripts/updateSchemas2022061402.go
b/models/migrationscripts/archived/issue_changelog.go
similarity index 66%
rename from models/migrationscripts/updateSchemas2022061402.go
rename to models/migrationscripts/archived/issue_changelog.go
index 1e013ec3..3f2027da 100644
--- a/models/migrationscripts/updateSchemas2022061402.go
+++ b/models/migrationscripts/archived/issue_changelog.go
@@ -15,18 +15,14 @@ See the License for the specific language governing
permissions and
limitations under the License.
*/
-package migrationscripts
+package archived
import (
- "context"
"time"
-
- "github.com/apache/incubator-devlake/models/migrationscripts/archived"
- "gorm.io/gorm"
)
-type Changelog20220614 struct {
- archived.DomainEntity
+type IssueChangelogs struct {
+ DomainEntity
// collected fields
IssueId string `gorm:"index;type:varchar(255)"`
@@ -41,20 +37,6 @@ type Changelog20220614 struct {
CreatedDate time.Time
}
-func (Changelog20220614) TableName() string {
- return "changelogs"
-}
-
-type updateSchemas2022061402 struct{}
-
-func (*updateSchemas2022061402) Up(ctx context.Context, db *gorm.DB) error {
- return db.Migrator().AutoMigrate(&Changelog20220614{})
-}
-
-func (*updateSchemas2022061402) Version() uint64 {
- return 20220614091600
-}
-
-func (*updateSchemas2022061402) Name() string {
- return "update table: changelogs, add standard_from, standard_to"
+func (IssueChangelogs) TableName() string {
+ return "issue_changelogs"
}
diff --git a/models/migrationscripts/archived/issue_history.go
b/models/migrationscripts/archived/issue_history.go
deleted file mode 100644
index efe5e631..00000000
--- a/models/migrationscripts/archived/issue_history.go
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-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 archived
-
-import (
- "time"
-)
-
-type IssueStatusHistory struct {
- NoPKModel
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- OriginalStatus string `gorm:"primaryKey;type:varchar(255)"`
- StartDate time.Time `gorm:"primaryKey"`
- EndDate *time.Time
-}
-
-func (IssueStatusHistory) TableName() string {
- return "issue_status_history"
-}
-
-type IssueAssigneeHistory struct {
- NoPKModel
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- Assignee string `gorm:"primaryKey;type:varchar(255)"`
- StartDate time.Time `gorm:"primaryKey"`
- EndDate *time.Time
-}
-
-func (IssueAssigneeHistory) TableName() string {
- return "issue_assignee_history"
-}
-
-type IssueSprintsHistory struct {
- NoPKModel
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- SprintId string `gorm:"primaryKey;type:varchar(255)"`
- StartDate time.Time `gorm:"primaryKey"`
- EndDate *time.Time
-}
-
-func (IssueSprintsHistory) TableName() string {
- return "issue_sprints_history"
-}
diff --git a/models/migrationscripts/archived/issue_repo_commits.go
b/models/migrationscripts/archived/issue_repo_commits.go
index 006125b9..84a6f9c9 100644
--- a/models/migrationscripts/archived/issue_repo_commits.go
+++ b/models/migrationscripts/archived/issue_repo_commits.go
@@ -23,3 +23,7 @@ type IssueRepoCommit struct {
RepoUrl string `gorm:"primaryKey;type:varchar(255)"`
CommitSha string `gorm:"primaryKey;type:varchar(255)"`
}
+
+func (IssueRepoCommit) TableName() string {
+ return "issue_repo_commits"
+}
diff --git a/models/migrationscripts/archived/job.go
b/models/migrationscripts/archived/job.go
index 1a5b449d..ea9502a6 100644
--- a/models/migrationscripts/archived/job.go
+++ b/models/migrationscripts/archived/job.go
@@ -21,3 +21,7 @@ type Job struct {
Name string `gorm:"type:varchar(255)"`
DomainEntity
}
+
+func (Job) TableName() string {
+ return "jobs"
+}
diff --git a/models/migrationscripts/archived/note.go
b/models/migrationscripts/archived/note.go
index 14376d3f..2006ac13 100644
--- a/models/migrationscripts/archived/note.go
+++ b/models/migrationscripts/archived/note.go
@@ -28,6 +28,10 @@ type Note struct {
Author string `gorm:"type:varchar(255)"`
Body string
Resolvable bool `gorm:"comment:Is or is not a review comment"`
- System bool `gorm:"comment:Is or is not auto-generated vs. human
generated"`
+ IsSystem bool `gorm:"comment:Is or is not auto-generated vs. human
generated"`
CreatedDate time.Time
}
+
+func (Note) TableName() string {
+ return "notes"
+}
diff --git a/models/migrationscripts/archived/notification.go
b/models/migrationscripts/archived/notification.go
index f9dfb125..1b1686a8 100644
--- a/models/migrationscripts/archived/notification.go
+++ b/models/migrationscripts/archived/notification.go
@@ -19,6 +19,10 @@ package archived
type NotificationType string
+const (
+ NotificationPipelineStatusChanged NotificationType =
"PipelineStatusChanged"
+)
+
// Notification records notifications sent by lake
type Notification struct {
Model
diff --git a/models/migrationscripts/archived/pipeline.go
b/models/migrationscripts/archived/pipeline.go
index 5ecf4b23..646b2bdf 100644
--- a/models/migrationscripts/archived/pipeline.go
+++ b/models/migrationscripts/archived/pipeline.go
@@ -25,18 +25,31 @@ import (
type Pipeline struct {
Model
- Name string `json:"name" gorm:"index"`
+ Name string `json:"name" gorm:"index"`
+ BlueprintId uint64 `json:"blueprintId"`
+ Plan datatypes.JSON `json:"plan"`
+ TotalTasks int `json:"totalTasks"`
+ FinishedTasks int `json:"finishedTasks"`
+ BeganAt *time.Time `json:"beganAt"`
+ FinishedAt *time.Time `json:"finishedAt" gorm:"index"`
+ Status string `json:"status"`
+ Message string `json:"message"`
+ SpentSeconds int `json:"spentSeconds"`
+ Stage int `json:"stage"`
+}
+
+// PipelineStage consist of multiple PipelineTasks, they will be executed in
parallel
+type PipelineStage []*PipelineTask
+
+// PipelinePlan consist of multiple PipelineStages, they will be executed in
sequential order
+type PipelinePlan []PipelineStage
+
+// We use a 2D array because the request body must be an array of a set of
tasks
+// to be executed concurrently, while each set is to be executed sequentially.
+type NewPipeline struct {
+ Name string `json:"name"`
+ Plan PipelinePlan `json:"plan"`
BlueprintId uint64
- Tasks datatypes.JSON
- TotalTasks int
- // Deprecated
- FinishedTasks int
- BeganAt *time.Time
- FinishedAt *time.Time `gorm:"index"`
- Status string
- Message string
- SpentSeconds int
- Step int
}
func (Pipeline) TableName() string {
diff --git a/models/migrationscripts/archived/pull_request.go
b/models/migrationscripts/archived/pull_request.go
index aaa7f9c9..d244f0f8 100644
--- a/models/migrationscripts/archived/pull_request.go
+++ b/models/migrationscripts/archived/pull_request.go
@@ -23,17 +23,17 @@ import (
type PullRequest struct {
DomainEntity
- BaseRepoId string `gorm:"index"`
- HeadRepoId string `gorm:"index"`
- Status string `gorm:"type:varchar(100);comment:open/closed or
other"`
- Number int
- Title string
- Description string
- Url string `gorm:"type:varchar(255)"`
- AuthorName string `gorm:"type:varchar(100)"`
+ BaseRepoId string `gorm:"index"`
+ HeadRepoId string `gorm:"index"`
+ Status string `gorm:"type:varchar(100);comment:open/closed or
other"`
+ Title string
+ Description string
+ Url string `gorm:"type:varchar(255)"`
+ AuthorName string `gorm:"type:varchar(100)"`
+ //User domainUser.User `gorm:"foreignKey:AuthorId"`
AuthorId string `gorm:"type:varchar(100)"`
ParentPrId string `gorm:"index;type:varchar(100)"`
- Key int
+ PullRequestKey int
CreatedDate time.Time
MergedDate *time.Time
ClosedDate *time.Time
@@ -46,18 +46,18 @@ type PullRequest struct {
HeadCommitSha string `gorm:"type:varchar(40)"`
}
+func (PullRequest) TableName() string {
+ return "pull_requests"
+}
+
type PullRequestCommit struct {
CommitSha string `gorm:"primaryKey;type:varchar(40)"`
PullRequestId string `json:"id"
gorm:"primaryKey;type:varchar(255);comment:This key is generated based on
details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
NoPKModel
}
-type PullRequestIssue struct {
- PullRequestId string `json:"id"
gorm:"primaryKey;type:varchar(255);comment:This key is generated based on
details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- PullRequestNumber int
- IssueNumber int
- NoPKModel
+func (PullRequestCommit) TableName() string {
+ return "pull_request_commits"
}
// Please note that Issue Labels can also apply to Pull Requests.
@@ -69,6 +69,10 @@ type PullRequestLabel struct {
NoPKModel
}
+func (PullRequestLabel) TableName() string {
+ return "pull_request_labels"
+}
+
type PullRequestComment struct {
DomainEntity
PullRequestId string `gorm:"index"`
@@ -77,4 +81,21 @@ type PullRequestComment struct {
CreatedDate time.Time
CommitSha string `gorm:"type:varchar(255)"`
Position int
+ Type string `gorm:"type:varchar(255)"`
+}
+
+func (PullRequestComment) TableName() string {
+ return "pull_request_comments"
+}
+
+type PullRequestIssue struct {
+ PullRequestId string `json:"id"
gorm:"primaryKey;type:varchar(255);comment:This key is generated based on
details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
+ IssueId string `gorm:"primaryKey;type:varchar(255)"`
+ PullRequestNumber int
+ IssueNumber int
+ NoPKModel
+}
+
+func (PullRequestIssue) TableName() string {
+ return "pull_request_issues"
}
diff --git a/models/migrationscripts/archived/ref.go
b/models/migrationscripts/archived/ref.go
index 8c639d1e..5dd71011 100644
--- a/models/migrationscripts/archived/ref.go
+++ b/models/migrationscripts/archived/ref.go
@@ -31,6 +31,10 @@ type Ref struct {
CreatedDate *time.Time
}
+func (Ref) TableName() string {
+ return "refs"
+}
+
type RefsCommitsDiff struct {
NewRefId string `gorm:"primaryKey;type:varchar(255)"`
OldRefId string `gorm:"primaryKey;type:varchar(255)"`
@@ -40,16 +44,25 @@ type RefsCommitsDiff struct {
SortingIndex int
}
+func (RefsCommitsDiff) TableName() string {
+ return "refs_commits_diffs"
+}
+
type RefsIssuesDiffs struct {
- NewRefId string `gorm:"type:varchar(255)"`
- OldRefId string `gorm:"type:varchar(255)"`
+ NewRefId string `gorm:"primaryKey;type:varchar(255)"`
+ OldRefId string `gorm:"primaryKey;type:varchar(255)"`
NewRefCommitSha string `gorm:"type:varchar(40)"`
OldRefCommitSha string `gorm:"type:varchar(40)"`
IssueNumber string `gorm:"type:varchar(255)"`
- IssueId string `gorm:";type:varchar(255)"`
+ IssueId string `gorm:"primaryKey;type:varchar(255)"`
NoPKModel
}
+func (RefsIssuesDiffs) TableName() string {
+ return "refs_issues_diffs"
+}
+
+// multi pk
type RefsPrCherrypick struct {
RepoName string `gorm:"type:varchar(255)"`
ParentPrKey int
@@ -59,3 +72,7 @@ type RefsPrCherrypick struct {
ParentPrId string `json:"parent_pr_id"
gorm:"primaryKey;type:varchar(255);comment:This key is generated based on
details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
NoPKModel
}
+
+func (RefsPrCherrypick) TableName() string {
+ return "refs_pr_cherrypicks"
+}
diff --git a/models/migrationscripts/archived/repo.go
b/models/migrationscripts/archived/repo.go
index dba76654..f1de6716 100644
--- a/models/migrationscripts/archived/repo.go
+++ b/models/migrationscripts/archived/repo.go
@@ -25,7 +25,7 @@ type Repo struct {
DomainEntity
Name string `json:"name"`
Url string `json:"url"`
- Description string `json:"Description"`
+ Description string `json:"description"`
OwnerId string `json:"ownerId" gorm:"type:varchar(255)"`
Language string `json:"language" gorm:"type:varchar(255)"`
ForkedFrom string `json:"forkedFrom"`
@@ -34,14 +34,26 @@ type Repo struct {
Deleted bool `json:"deleted"`
}
+func (Repo) TableName() string {
+ return "repos"
+}
+
type RepoLanguage struct {
RepoId string `json:"repoId" gorm:"index;type:varchar(255)"`
Language string `json:"language" gorm:"type:varchar(255)"`
Bytes int
}
+func (RepoLanguage) TableName() string {
+ return "repo_languages"
+}
+
type RepoCommit struct {
RepoId string `json:"repoId" gorm:"primaryKey;type:varchar(255)"`
CommitSha string `json:"commitSha" gorm:"primaryKey;type:varchar(40)"`
NoPKModel
}
+
+func (RepoCommit) TableName() string {
+ return "repo_commits"
+}
diff --git a/models/migrationscripts/archived/sprint.go
b/models/migrationscripts/archived/sprint.go
index c25561c6..aa70268d 100644
--- a/models/migrationscripts/archived/sprint.go
+++ b/models/migrationscripts/archived/sprint.go
@@ -21,6 +21,12 @@ import (
"time"
)
+var (
+ BeforeSprint = "BEFORE_SPRINT"
+ DuringSprint = "DURING_SPRINT"
+ AfterSprint = "AFTER_SPRINT"
+)
+
type Sprint struct {
DomainEntity
Name string `gorm:"type:varchar(255)"`
@@ -32,13 +38,16 @@ type Sprint struct {
OriginalBoardID string `gorm:"type:varchar(255)"`
}
+func (Sprint) TableName() string {
+ return "sprints"
+}
+
type SprintIssue struct {
NoPKModel
- SprintId string `gorm:"primaryKey;type:varchar(255)"`
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- IsRemoved bool
- AddedDate *time.Time
- RemovedDate *time.Time
- AddedStage *string `gorm:"type:varchar(255)"`
- ResolvedStage *string `gorm:"type:varchar(255)"`
+ SprintId string `gorm:"primaryKey;type:varchar(255)"`
+ IssueId string `gorm:"primaryKey;type:varchar(255)"`
+}
+
+func (SprintIssue) TableName() string {
+ return "sprint_issues"
}
diff --git a/models/migrationscripts/archived/task.go
b/models/migrationscripts/archived/task.go
index 8b4c6730..9488ad49 100644
--- a/models/migrationscripts/archived/task.go
+++ b/models/migrationscripts/archived/task.go
@@ -23,20 +23,55 @@ import (
"gorm.io/datatypes"
)
+const (
+ TASK_CREATED = "TASK_CREATED"
+ TASK_RUNNING = "TASK_RUNNING"
+ TASK_COMPLETED = "TASK_COMPLETED"
+ TASK_FAILED = "TASK_FAILED"
+)
+
+type TaskProgressDetail struct {
+ TotalSubTasks int `json:"totalSubTasks"`
+ FinishedSubTasks int `json:"finishedSubTasks"`
+ TotalRecords int `json:"totalRecords"`
+ FinishedRecords int `json:"finishedRecords"`
+ SubTaskName string `json:"subTaskName"`
+ SubTaskNumber int `json:"subTaskNumber"`
+}
+
type Task struct {
Model
- Plugin string `gorm:"index"`
- Options datatypes.JSON
- Status string
- Message string
- Progress float32
- FailedSubTask string
- PipelineId uint64 `gorm:"index"`
- PipelineRow int
- PipelineCol int
- BeganAt *time.Time
- FinishedAt *time.Time `gorm:"index"`
- SpentSeconds int
+ Plugin string `json:"plugin" gorm:"index"`
+ Subtasks datatypes.JSON `json:"subtasks"`
+ Options datatypes.JSON `json:"options"`
+ Status string `json:"status"`
+ Message string `json:"message"`
+ Progress float32 `json:"progress"`
+ ProgressDetail *TaskProgressDetail `json:"progressDetail" gorm:"-"`
+
+ FailedSubTask string `json:"failedSubTask"`
+ PipelineId uint64 `json:"pipelineId" gorm:"index"`
+ PipelineRow int `json:"pipelineRow"`
+ PipelineCol int `json:"pipelineCol"`
+ BeganAt *time.Time `json:"beganAt"`
+ FinishedAt *time.Time `json:"finishedAt" gorm:"index"`
+ SpentSeconds int `json:"spentSeconds"`
+}
+
+// PipelineTask represents a smallest unit of execution inside a PipelinePlan
+type PipelineTask struct {
+ // Plugin name
+ Plugin string `json:"plugin" binding:"required"`
+ Subtasks []string `json:"subtasks"`
+ Options map[string]interface{} `json:"options"`
+}
+
+type NewTask struct {
+ // Plugin name
+ *PipelineTask
+ PipelineId uint64 `json:"-"`
+ PipelineRow int `json:"-"`
+ PipelineCol int `json:"-"`
}
func (Task) TableName() string {
diff --git a/models/migrationscripts/archived/job.go
b/models/migrationscripts/archived/team.go
similarity index 77%
copy from models/migrationscripts/archived/job.go
copy to models/migrationscripts/archived/team.go
index 1a5b449d..ce7d1fa2 100644
--- a/models/migrationscripts/archived/job.go
+++ b/models/migrationscripts/archived/team.go
@@ -17,7 +17,14 @@ limitations under the License.
package archived
-type Job struct {
- Name string `gorm:"type:varchar(255)"`
+type Team struct {
DomainEntity
+ Name string `gorm:"type:varchar(255)"`
+ Alias string `gorm:"type:varchar(255)"`
+ ParentId string `gorm:"type:varchar(255)"`
+ SortingIndex int
+}
+
+func (Team) TableName() string {
+ return "teams"
}
diff --git a/models/migrationscripts/archived/job.go
b/models/migrationscripts/archived/team_user.go
similarity index 80%
copy from models/migrationscripts/archived/job.go
copy to models/migrationscripts/archived/team_user.go
index 1a5b449d..9cd3bf27 100644
--- a/models/migrationscripts/archived/job.go
+++ b/models/migrationscripts/archived/team_user.go
@@ -17,7 +17,11 @@ limitations under the License.
package archived
-type Job struct {
- Name string `gorm:"type:varchar(255)"`
- DomainEntity
+type TeamUser struct {
+ TeamId string `gorm:"primaryKey;type:varchar(255)"`
+ UserId string `gorm:"primaryKey;type:varchar(255)"`
+}
+
+func (TeamUser) TableName() string {
+ return "team_users"
}
diff --git a/models/migrationscripts/archived/user.go
b/models/migrationscripts/archived/user.go
index 302f001f..77c93e81 100644
--- a/models/migrationscripts/archived/user.go
+++ b/models/migrationscripts/archived/user.go
@@ -19,8 +19,10 @@ package archived
type User struct {
DomainEntity
- Name string `gorm:"type:varchar(255)"`
- Email string `gorm:"type:varchar(255)"`
- AvatarUrl string `gorm:"type:varchar(255)"`
- Timezone string `gorm:"type:varchar(255)"`
+ Email string `gorm:"type:varchar(255)"`
+ Name string `gorm:"type:varchar(255)"`
+}
+
+func (User) TableName() string {
+ return "users"
}
diff --git a/models/migrationscripts/archived/job.go
b/models/migrationscripts/archived/user_account.go
similarity index 79%
copy from models/migrationscripts/archived/job.go
copy to models/migrationscripts/archived/user_account.go
index 1a5b449d..5a9acd7f 100644
--- a/models/migrationscripts/archived/job.go
+++ b/models/migrationscripts/archived/user_account.go
@@ -17,7 +17,11 @@ limitations under the License.
package archived
-type Job struct {
- Name string `gorm:"type:varchar(255)"`
- DomainEntity
+type UserAccount struct {
+ UserId string `gorm:"primaryKey;type:varchar(255)"`
+ AccountId string `gorm:"primaryKey;type:varchar(255)"`
+}
+
+func (UserAccount) TableName() string {
+ return "user_accounts"
}
diff --git a/models/migrationscripts/archived/worklog.go
b/models/migrationscripts/archived/worklog.go
index f006bc03..07a9f52c 100644
--- a/models/migrationscripts/archived/worklog.go
+++ b/models/migrationscripts/archived/worklog.go
@@ -30,3 +30,7 @@ type IssueWorklog struct {
StartedDate *time.Time
IssueId string `gorm:"index;type:varchar(255)"`
}
+
+func (IssueWorklog) TableName() string {
+ return "issue_worklogs"
+}
diff --git a/models/migrationscripts/init_schema.go
b/models/migrationscripts/init_schema.go
index 30ad7558..7143d6a6 100644
--- a/models/migrationscripts/init_schema.go
+++ b/models/migrationscripts/init_schema.go
@@ -27,12 +27,55 @@ import (
type initSchemas struct{}
func (*initSchemas) Up(ctx context.Context, db *gorm.DB) error {
+ err := db.Migrator().DropTable(
+ "issue_assignee_history",
+ "issue_status_history",
+ "issue_sprints_history",
+ "users",
+ &archived.Task{},
+ &archived.Notification{},
+ &archived.Pipeline{},
+ &archived.Blueprint{},
+ &archived.Repo{},
+ &archived.Commit{},
+ &archived.CommitParent{},
+ &archived.PullRequest{},
+ &archived.PullRequestCommit{},
+ &archived.PullRequestComment{},
+ &archived.PullRequestLabel{},
+ &archived.Note{},
+ &archived.RepoCommit{},
+ &archived.Ref{},
+ &archived.RefsCommitsDiff{},
+ &archived.CommitFile{},
+ &archived.Board{},
+ &archived.Issue{},
+ &archived.IssueLabel{},
+ &archived.IssueComment{},
+ &archived.BoardIssue{},
+ &archived.BoardSprint{},
+ &archived.IssueChangelogs{},
+ &archived.Sprint{},
+ &archived.SprintIssue{},
+ &archived.Job{},
+ &archived.Build{},
+ &archived.IssueWorklog{},
+ &archived.BoardRepo{},
+ &archived.PullRequestIssue{},
+ &archived.IssueCommit{},
+ &archived.IssueRepoCommit{},
+ &archived.RefsIssuesDiffs{},
+ &archived.RefsPrCherrypick{},
+ )
+ if err != nil {
+ return err
+ }
+
return db.Migrator().AutoMigrate(
&archived.Task{},
&archived.Notification{},
&archived.Pipeline{},
&archived.Blueprint{},
- &archived.User{},
&archived.Repo{},
&archived.Commit{},
&archived.CommitParent{},
@@ -51,12 +94,9 @@ func (*initSchemas) Up(ctx context.Context, db *gorm.DB)
error {
&archived.IssueComment{},
&archived.BoardIssue{},
&archived.BoardSprint{},
- &archived.Changelog{},
+ &archived.IssueChangelogs{},
&archived.Sprint{},
&archived.SprintIssue{},
- &archived.IssueStatusHistory{},
- &archived.IssueSprintsHistory{},
- &archived.IssueAssigneeHistory{},
&archived.Job{},
&archived.Build{},
&archived.IssueWorklog{},
@@ -66,11 +106,16 @@ func (*initSchemas) Up(ctx context.Context, db *gorm.DB)
error {
&archived.IssueRepoCommit{},
&archived.RefsIssuesDiffs{},
&archived.RefsPrCherrypick{},
+ &archived.Account{},
+ &archived.User{},
+ &archived.Team{},
+ &archived.UserAccount{},
+ &archived.TeamUser{},
)
}
func (*initSchemas) Version() uint64 {
- return 20220406212344
+ return 20220707232344
}
func (*initSchemas) Owner() string {
diff --git a/models/migrationscripts/register.go
b/models/migrationscripts/register.go
index ddd1b4d6..5201eb98 100644
--- a/models/migrationscripts/register.go
+++ b/models/migrationscripts/register.go
@@ -23,14 +23,5 @@ import "github.com/apache/incubator-devlake/migration"
func All() []migration.Script {
return []migration.Script{
new(initSchemas),
- new(updateSchemas20220505), new(updateSchemas20220507),
new(updateSchemas20220510),
- new(updateSchemas20220513), new(updateSchemas20220524),
new(updateSchemas20220526),
- new(updateSchemas20220527), new(updateSchemas20220528),
new(updateSchemas20220601),
- new(updateSchemas20220602), new(updateSchemas20220612),
new(updateSchemas20220613),
- new(updateSchemas20220614), new(updateSchemas2022061402),
new(updateSchemas20220616),
- new(blueprintNormalMode),
- new(UpdateSchemas20220630),
- new(UpdateSchemas20220704),
- new(UpdateSchemas20220705),
}
}
diff --git a/models/migrationscripts/updateSchemas20220505.go
b/models/migrationscripts/updateSchemas20220505.go
deleted file mode 100644
index b29cc2fa..00000000
--- a/models/migrationscripts/updateSchemas20220505.go
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-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 updateSchemas20220505 struct{}
-
-func (*updateSchemas20220505) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().RenameColumn(archived.Pipeline{}, "step", "stage")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220505) Version() uint64 {
- return 20220505212344
-}
-
-func (*updateSchemas20220505) Name() string {
- return "Rename step to stage "
-}
diff --git a/models/migrationscripts/updateSchemas20220507.go
b/models/migrationscripts/updateSchemas20220507.go
deleted file mode 100644
index 008e3628..00000000
--- a/models/migrationscripts/updateSchemas20220507.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-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"
- "time"
-)
-
-type Issue20220507 struct {
- archived.DomainEntity
- Url string `gorm:"type:varchar(255)"`
- IconURL string
`gorm:"type:varchar(255);column:icon_url"`
- Number string `gorm:"type:varchar(255)"`
- Title string
- Description string
- EpicKey string `gorm:"type:varchar(255)"`
- Type string `gorm:"type:varchar(100)"`
- Status string `gorm:"type:varchar(100)"`
- OriginalStatus string `gorm:"type:varchar(100)"`
- StoryPoint uint
- ResolutionDate *time.Time
- CreatedDate *time.Time
- UpdatedDate *time.Time
- LeadTimeMinutes uint
- ParentIssueId string `gorm:"type:varchar(255)"`
- Priority string `gorm:"type:varchar(255)"`
- OriginalEstimateMinutes int64
- TimeSpentMinutes int64
- TimeRemainingMinutes int64
- CreatorId string `gorm:"type:varchar(255)"`
- AssigneeId string `gorm:"type:varchar(255)"`
- AssigneeName string `gorm:"type:varchar(255)"`
- Severity string `gorm:"type:varchar(255)"`
- Component string `gorm:"type:varchar(255)"`
-}
-
-func (Issue20220507) TableName() string {
- return "issues"
-}
-
-type updateSchemas20220507 struct{}
-
-func (*updateSchemas20220507) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().AddColumn(&Issue20220507{}, "icon_url")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220507) Version() uint64 {
- return 20220507154644
-}
-
-func (*updateSchemas20220507) Name() string {
- return "Add icon_url column to Issue"
-}
diff --git a/models/migrationscripts/updateSchemas20220510.go
b/models/migrationscripts/updateSchemas20220510.go
deleted file mode 100644
index 2114a7b2..00000000
--- a/models/migrationscripts/updateSchemas20220510.go
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-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 updateSchemas20220510 struct{}
-
-func (*updateSchemas20220510) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().RenameColumn(archived.Note{}, "system",
"is_system")
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func (*updateSchemas20220510) Version() uint64 {
- return 20220510212399
-}
-
-func (*updateSchemas20220510) Owner() string {
- return "Framework"
-}
-
-func (*updateSchemas20220510) Name() string {
- return "Change key word system to is_system"
-}
diff --git a/models/migrationscripts/updateSchemas20220513.go
b/models/migrationscripts/updateSchemas20220513.go
deleted file mode 100644
index 883df03e..00000000
--- a/models/migrationscripts/updateSchemas20220513.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-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"
- "gorm.io/gorm/clause"
-)
-
-type RefsIssuesDiffs20220513 struct {
- NewRefId string `gorm:"primaryKey;type:varchar(255)"`
- OldRefId string `gorm:"primaryKey;type:varchar(255)"`
- NewRefCommitSha string `gorm:"type:varchar(40)"`
- OldRefCommitSha string `gorm:"type:varchar(40)"`
- IssueNumber string `gorm:"type:varchar(255)"`
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- archived.NoPKModel
-}
-
-func (RefsIssuesDiffs20220513) TableName() string {
- return "refs_issues_diffs_20220513"
-}
-
-type RefsIssuesDiffsNew struct {
- NewRefId string `gorm:"primaryKey;type:varchar(255)"`
- OldRefId string `gorm:"primaryKey;type:varchar(255)"`
- NewRefCommitSha string `gorm:"type:varchar(40)"`
- OldRefCommitSha string `gorm:"type:varchar(40)"`
- IssueNumber string `gorm:"type:varchar(255)"`
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- archived.NoPKModel
-}
-
-func (RefsIssuesDiffsNew) TableName() string {
- return "refs_issues_diffs"
-}
-
-type updateSchemas20220513 struct{}
-
-func (*updateSchemas20220513) Up(ctx context.Context, db *gorm.DB) error {
- cursor, err := db.Model(archived.RefsIssuesDiffs{}).Rows()
- if err != nil {
- return err
- }
- defer cursor.Close()
- // 1. create a temporary table to store unique records
- err = db.Migrator().CreateTable(RefsIssuesDiffs20220513{})
- if err != nil {
- return err
- }
- // 2. dedupe records and insert into the temporary table
- for cursor.Next() {
- //inputRow := archived.RefsIssuesDiffs{}
- inputRow := RefsIssuesDiffs20220513{}
- err := db.ScanRows(cursor, &inputRow)
- if err != nil {
- return err
- }
- err = db.Clauses(clause.OnConflict{UpdateAll:
true}).Create(inputRow).Error
- if err != nil {
- return err
- }
- }
- // 3. drop old table
- err = db.Migrator().DropTable(archived.RefsIssuesDiffs{})
- if err != nil {
- return err
- }
- // 4. rename the temporary table to the old table
- err = db.Migrator().RenameTable(RefsIssuesDiffs20220513{},
RefsIssuesDiffsNew{})
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func (*updateSchemas20220513) Version() uint64 {
- return 20220513212319
-}
-
-func (*updateSchemas20220513) Name() string {
- return "refs_issues_diffs add primary key"
-}
diff --git a/models/migrationscripts/updateSchemas20220524.go
b/models/migrationscripts/updateSchemas20220524.go
deleted file mode 100644
index 9eb6a8f7..00000000
--- a/models/migrationscripts/updateSchemas20220524.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-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 Issue20220524 struct {
- archived.DomainEntity
- CreatorName string `gorm:"type:varchar(255)"`
-}
-
-func (Issue20220524) TableName() string {
- return "issues"
-}
-
-type updateSchemas20220524 struct{}
-
-func (*updateSchemas20220524) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().AddColumn(&Issue20220524{}, "creator_name")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220524) Version() uint64 {
- return 20220524000005
-}
-
-func (*updateSchemas20220524) Name() string {
- return "Add creator_name column to Issue"
-}
diff --git a/models/migrationscripts/updateSchemas20220526.go
b/models/migrationscripts/updateSchemas20220526.go
deleted file mode 100644
index 30eb450a..00000000
--- a/models/migrationscripts/updateSchemas20220526.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-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"
- "time"
-
- "github.com/apache/incubator-devlake/models/domainlayer"
- "github.com/apache/incubator-devlake/models/migrationscripts/archived"
- "gorm.io/gorm"
-)
-
-type PullRequest20220526 struct {
- domainlayer.DomainEntity
- BaseRepoId string `gorm:"index"`
- HeadRepoId string `gorm:"index"`
- Status string `gorm:"type:varchar(100);comment:open/closed or
other"`
- Number int
- Title string
- Description string
- Url string `gorm:"type:varchar(255)"`
- AuthorName string `gorm:"type:varchar(100)"`
- AuthorId string `gorm:"type:varchar(100)"`
- ParentPrId string `gorm:"index;type:varchar(100)"`
- PullRequestKey int
- CreatedDate time.Time
- MergedDate *time.Time
- ClosedDate *time.Time
- Type string `gorm:"type:varchar(100)"`
- Component string `gorm:"type:varchar(100)"`
- MergeCommitSha string `gorm:"type:varchar(40)"`
- HeadRef string `gorm:"type:varchar(255)"`
- BaseRef string `gorm:"type:varchar(255)"`
- BaseCommitSha string `gorm:"type:varchar(40)"`
- HeadCommitSha string `gorm:"type:varchar(40)"`
-}
-
-func (PullRequest20220526) TableName() string {
- return "pull_requests"
-}
-
-type updateSchemas20220526 struct{}
-
-func (*updateSchemas20220526) Up(ctx context.Context, db *gorm.DB) error {
-
- err := db.Migrator().RenameColumn(archived.PullRequest{}, "key",
"pull_request_key")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220526) Version() uint64 {
- return 20220526000005
-}
-
-func (*updateSchemas20220526) Name() string {
- return "update `key` columns to `pull_request_key` at pull_requests"
-}
diff --git a/models/migrationscripts/updateSchemas20220527.go
b/models/migrationscripts/updateSchemas20220527.go
deleted file mode 100644
index 1f11f0ab..00000000
--- a/models/migrationscripts/updateSchemas20220527.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-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"
- "time"
-
- "github.com/apache/incubator-devlake/models/domainlayer"
- "github.com/apache/incubator-devlake/models/migrationscripts/archived"
- "gorm.io/gorm"
-)
-
-type Changelog20220527 struct {
- domainlayer.DomainEntity
-
- // collected fields
- IssueId string `gorm:"index;type:varchar(255)"`
- AuthorId string `gorm:"type:varchar(255)"`
- AuthorName string `gorm:"type:varchar(255)"`
- FieldId string `gorm:"type:varchar(255)"`
- FieldName string `gorm:"type:varchar(255)"`
- FromValue string
- ToValue string
- CreatedDate time.Time
-}
-
-func (Changelog20220527) TableName() string {
- return "changelogs"
-}
-
-type updateSchemas20220527 struct{}
-
-func (*updateSchemas20220527) Up(ctx context.Context, db *gorm.DB) error {
-
- err := db.Migrator().RenameColumn(archived.Changelog{}, "from",
"from_value")
- if err != nil {
- return err
- }
- err = db.Migrator().RenameColumn(archived.Changelog{}, "to", "to_value")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220527) Version() uint64 {
- return 20220527000005
-}
-
-func (*updateSchemas20220527) Name() string {
- return "update `from` and `to` columns to `from_value` and `to_value`
at changelogs"
-}
diff --git a/models/migrationscripts/updateSchemas20220528.go
b/models/migrationscripts/updateSchemas20220528.go
deleted file mode 100644
index 755c3502..00000000
--- a/models/migrationscripts/updateSchemas20220528.go
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-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"
- "time"
-
- "gorm.io/gorm"
-
- "github.com/apache/incubator-devlake/models/common"
-)
-
-type SprintIssue20220528 struct {
- common.NoPKModel
- SprintId string `gorm:"primaryKey;type:varchar(255)"`
- IssueId string `gorm:"primaryKey;type:varchar(255)"`
- IsRemoved bool
- AddedDate *time.Time
- RemovedDate *time.Time
- AddedStage *string `gorm:"type:varchar(255)"`
- ResolvedStage *string `gorm:"type:varchar(255)"`
-}
-
-func (SprintIssue20220528) TableName() string {
- return "sprint_issues"
-}
-
-type updateSchemas20220528 struct{}
-
-func (*updateSchemas20220528) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().DropColumn(&SprintIssue20220528{}, "is_removed")
- if err != nil {
- return err
- }
- err = db.Migrator().DropColumn(&SprintIssue20220528{}, "added_date")
- if err != nil {
- return err
- }
- err = db.Migrator().DropColumn(&SprintIssue20220528{}, "removed_date")
- if err != nil {
- return err
- }
- err = db.Migrator().DropColumn(&SprintIssue20220528{}, "added_stage")
- if err != nil {
- return err
- }
- return db.Migrator().DropColumn(&SprintIssue20220528{},
"resolved_stage")
-}
-
-func (*updateSchemas20220528) Version() uint64 {
- return 20220528110537
-}
-
-func (*updateSchemas20220528) Name() string {
- return "remove columns: is_removed, added_date, removed_date,
added_stage, resolved_stage"
-}
diff --git a/models/migrationscripts/updateSchemas20220601.go
b/models/migrationscripts/updateSchemas20220601.go
deleted file mode 100644
index 55a77d80..00000000
--- a/models/migrationscripts/updateSchemas20220601.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-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"
- "time"
-
- "github.com/apache/incubator-devlake/models/common"
- "gorm.io/datatypes"
- "gorm.io/gorm"
-)
-
-type Task20220601 struct {
- common.Model
- Plugin string `json:"plugin" gorm:"index"`
- Subtasks datatypes.JSON `json:"subtasks"`
- Options datatypes.JSON `json:"options"`
- Status string `json:"status"`
- Message string `json:"message"`
- Progress float32 `json:"progress"`
- FailedSubTask string `json:"failedSubTask"`
- PipelineId uint64 `json:"pipelineId" gorm:"index"`
- PipelineRow int `json:"pipelineRow"`
- PipelineCol int `json:"pipelineCol"`
- BeganAt *time.Time `json:"beganAt"`
- FinishedAt *time.Time `json:"finishedAt" gorm:"index"`
- SpentSeconds int `json:"spentSeconds"`
-}
-
-func (Task20220601) TableName() string {
- return "_devlake_tasks"
-}
-
-type updateSchemas20220601 struct{}
-
-func (*updateSchemas20220601) Up(ctx context.Context, db *gorm.DB) error {
-
- err := db.Migrator().AddColumn(Task20220601{}, "subtasks")
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func (*updateSchemas20220601) Version() uint64 {
- return 20220601000005
-}
-
-func (*updateSchemas20220601) Name() string {
- return "add column `subtasks` at _devlake_tasks"
-}
diff --git a/models/migrationscripts/updateSchemas20220602.go
b/models/migrationscripts/updateSchemas20220602.go
deleted file mode 100644
index fed7eca3..00000000
--- a/models/migrationscripts/updateSchemas20220602.go
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-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 updateSchemas20220602 struct{}
-
-func (*updateSchemas20220602) Up(ctx context.Context, db *gorm.DB) error {
- return db.Migrator().DropTable(&archived.IssueAssigneeHistory{},
&archived.IssueStatusHistory{}, &archived.IssueSprintsHistory{})
-}
-
-func (*updateSchemas20220602) Version() uint64 {
- return 20220602154333
-}
-
-func (*updateSchemas20220602) Name() string {
- return "drop tables: issue_assignee_history, issue_status_history,
issue_sprints_history"
-}
diff --git a/models/migrationscripts/updateSchemas20220612.go
b/models/migrationscripts/updateSchemas20220612.go
deleted file mode 100644
index 60e42814..00000000
--- a/models/migrationscripts/updateSchemas20220612.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-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 updateSchemas20220612 struct{}
-
-func (*updateSchemas20220612) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().DropTable(&archived.Job{}, &archived.Build{})
- if err != nil {
- return err
- }
- err = db.Migrator().CreateTable(&archived.Job{}, &archived.Build{})
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func (*updateSchemas20220612) Version() uint64 {
- return 20220612154333
-}
-
-func (*updateSchemas20220612) Name() string {
- return "Regenerate tables jobs and builds"
-}
diff --git a/models/migrationscripts/updateSchemas20220613.go
b/models/migrationscripts/updateSchemas20220613.go
deleted file mode 100644
index 362c3b36..00000000
--- a/models/migrationscripts/updateSchemas20220613.go
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-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"
- "time"
-
- "github.com/apache/incubator-devlake/models/domainlayer"
- "gorm.io/gorm"
-)
-
-type Issue20220613 struct {
- domainlayer.DomainEntity
- Url string `gorm:"type:varchar(255)"`
- IconURL string
`gorm:"type:varchar(255);column:icon_url"`
- Number string `gorm:"type:varchar(255)"`
- Title string
- Description string
- EpicKey string `gorm:"type:varchar(255)"`
- Type string `gorm:"type:varchar(100)"`
- Status string `gorm:"type:varchar(100)"`
- OriginalStatus string `gorm:"type:varchar(100)"`
- StoryPoint uint
- ResolutionDate *time.Time
- CreatedDate *time.Time
- UpdatedDate *time.Time
- LeadTimeMinutes uint
- ParentIssueId string `gorm:"type:varchar(255)"`
- Priority string `gorm:"type:varchar(255)"`
- OriginalEstimateMinutes int64
- TimeSpentMinutes int64
- TimeRemainingMinutes int64
- CreatorId string `gorm:"type:varchar(255)"`
- CreatorName string `gorm:"type:varchar(255)"`
- AssigneeId string `gorm:"type:varchar(255)"`
- AssigneeName string `gorm:"type:varchar(255)"`
- Severity string `gorm:"type:varchar(255)"`
- Component string `gorm:"type:varchar(255)"`
-}
-
-func (Issue20220613) TableName() string {
- return "issues"
-}
-
-type updateSchemas20220613 struct{}
-
-func (*updateSchemas20220613) Up(ctx context.Context, db *gorm.DB) error {
-
- err := db.Migrator().RenameColumn(Issue20220613{}, "number",
"issue_key")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220613) Version() uint64 {
- return 20220613000005
-}
-
-func (*updateSchemas20220613) Name() string {
- return "update `number` column to `issue_key` at issues"
-}
diff --git a/models/migrationscripts/updateSchemas20220614.go
b/models/migrationscripts/updateSchemas20220614.go
deleted file mode 100644
index 36876464..00000000
--- a/models/migrationscripts/updateSchemas20220614.go
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-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"
- "time"
-
- "github.com/apache/incubator-devlake/models/domainlayer"
- "gorm.io/gorm"
-)
-
-type PullRequest20220614 struct {
- domainlayer.DomainEntity
- BaseRepoId string `gorm:"index"`
- HeadRepoId string `gorm:"index"`
- Status string `gorm:"type:varchar(100);comment:open/closed or
other"`
- Number int
- Title string
- Description string
- Url string `gorm:"type:varchar(255)"`
- AuthorName string `gorm:"type:varchar(100)"`
- AuthorId string `gorm:"type:varchar(100)"`
- ParentPrId string `gorm:"index;type:varchar(100)"`
- PullRequestKey int
- CreatedDate time.Time
- MergedDate *time.Time
- ClosedDate *time.Time
- Type string `gorm:"type:varchar(100)"`
- Component string `gorm:"type:varchar(100)"`
- MergeCommitSha string `gorm:"type:varchar(40)"`
- HeadRef string `gorm:"type:varchar(255)"`
- BaseRef string `gorm:"type:varchar(255)"`
- BaseCommitSha string `gorm:"type:varchar(40)"`
- HeadCommitSha string `gorm:"type:varchar(40)"`
-}
-
-func (PullRequest20220614) TableName() string {
- return "pull_requests"
-}
-
-type updateSchemas20220614 struct{}
-
-func (*updateSchemas20220614) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().DropColumn(&PullRequest20220614{}, "number")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*updateSchemas20220614) Version() uint64 {
- return 20220614110537
-}
-
-func (*updateSchemas20220614) Name() string {
- return "remove columns number at pull_requests"
-}
diff --git a/models/migrationscripts/updateSchemas20220616.go
b/models/migrationscripts/updateSchemas20220616.go
deleted file mode 100644
index 9729677c..00000000
--- a/models/migrationscripts/updateSchemas20220616.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-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"
-
- "gorm.io/gorm"
-)
-
-type Blueprint20220616 struct {
- Mode string `json:"mode" gorm:"varchar(20)"
validate:"required,oneof=NORMAL ADVANCED"`
- IsManual bool `json:"isManual"`
-}
-
-func (Blueprint20220616) TableName() string {
- return "_devlake_blueprints"
-}
-
-type updateSchemas20220616 struct{}
-
-func (*updateSchemas20220616) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().AutoMigrate(&Blueprint20220616{})
- if err != nil {
- return err
- }
- db.Model(&Blueprint20220616{}).Where("mode is null").Update("mode",
"ADVANCED")
- db.Model(&Blueprint20220616{}).Where("is_manual is
null").Update("is_manual", false)
- return nil
-}
-
-func (*updateSchemas20220616) Version() uint64 {
- return 20220616110537
-}
-
-func (*updateSchemas20220616) Name() string {
- return "add mode field to blueprint"
-}
diff --git a/models/migrationscripts/updateSchemas20220630.go
b/models/migrationscripts/updateSchemas20220630.go
deleted file mode 100644
index 5d641e8c..00000000
--- a/models/migrationscripts/updateSchemas20220630.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-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"
-
- "gorm.io/gorm"
-)
-
-type Issue20220630 struct {
- StoryPoint int64
- TmpStoryPoint uint
-}
-
-func (Issue20220630) TableName() string {
- return "issues"
-}
-
-type UpdateSchemas20220630 struct {
-}
-
-func (u *UpdateSchemas20220630) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().RenameColumn(&Issue20220630{}, "story_point",
"tmp_story_point")
- if err != nil {
- return err
- }
- err = db.Migrator().AddColumn(&Issue20220630{}, "story_point")
- if err != nil {
- return err
- }
- err = db.Model(&Issue20220630{}).Where("1 =
1").UpdateColumn("story_point", gorm.Expr("tmp_story_point")).Error
- if err != nil {
- return err
- }
- return db.Migrator().DropColumn(&Issue20220630{}, "tmp_story_point")
-}
-
-func (*UpdateSchemas20220630) Version() uint64 {
- return 20220630131508
-}
-
-func (*UpdateSchemas20220630) Name() string {
- return "alter story_point from unsigned to signed"
-}
diff --git a/models/migrationscripts/updateSchemas20220704.go
b/models/migrationscripts/updateSchemas20220704.go
deleted file mode 100644
index 258ecd32..00000000
--- a/models/migrationscripts/updateSchemas20220704.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-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"
- "gorm.io/gorm"
-)
-
-type PullRequestComment0704 struct {
- Type string `gorm:"type:varchar(255)"`
-}
-
-func (PullRequestComment0704) TableName() string {
- return "pull_request_comments"
-}
-
-type UpdateSchemas20220704 struct {
-}
-
-func (u *UpdateSchemas20220704) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().AddColumn(&PullRequestComment0704{}, "type")
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*UpdateSchemas20220704) Version() uint64 {
- return 20220704110137
-}
-
-func (*UpdateSchemas20220704) Name() string {
- return "add type to pr_comment"
-}
diff --git a/models/migrationscripts/updateSchemas20220705.go
b/models/migrationscripts/updateSchemas20220705.go
deleted file mode 100644
index 0a34f76e..00000000
--- a/models/migrationscripts/updateSchemas20220705.go
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-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"
- "time"
-
- "github.com/apache/incubator-devlake/models/migrationscripts/archived"
- "gorm.io/gorm"
-)
-
-type User struct {
- archived.DomainEntity
- Email string `gorm:"type:varchar(255)"`
- Name string `gorm:"type:varchar(255)"`
-}
-
-type Account struct {
- archived.DomainEntity
- Email string `gorm:"type:varchar(255)"`
- FullName string `gorm:"type:varchar(255)"`
- UserName string `gorm:"type:varchar(255)"`
- AvatarUrl string `gorm:"type:varchar(255)"`
- Organization string `gorm:"type:varchar(255)"`
- CreatedDate *time.Time
- Status int
-}
-
-type UserAccount struct {
- UserId string `gorm:"primaryKey;type:varchar(255)"`
- AccountId string `gorm:"primaryKey;type:varchar(255)"`
-}
-
-type Team struct {
- archived.DomainEntity
- Name string `gorm:"type:varchar(255)"`
- Alias string `gorm:"type:varchar(255)"`
- ParentId string `gorm:"type:varchar(255)"`
- SortingIndex int
-}
-
-type TeamUser struct {
- TeamId string `gorm:"primaryKey;type:varchar(255)"`
- UserId string `gorm:"primaryKey;type:varchar(255)"`
-}
-
-type UpdateSchemas20220705 struct {
-}
-
-func (u *UpdateSchemas20220705) Up(ctx context.Context, db *gorm.DB) error {
- err := db.Migrator().RenameTable("users", "accounts")
- if err != nil {
- return err
- }
- err = db.Migrator().DropColumn(&Account{}, "timezone")
- if err != nil {
- return err
- }
- err = db.Migrator().AutoMigrate(&User{})
- if err != nil {
- return err
- }
- err = db.Migrator().AutoMigrate(&Account{})
- if err != nil {
- return err
- }
- err = db.Migrator().AutoMigrate(&UserAccount{})
- if err != nil {
- return err
- }
- err = db.Migrator().AutoMigrate(&Team{})
- if err != nil {
- return err
- }
- err = db.Migrator().AutoMigrate(&TeamUser{})
- if err != nil {
- return err
- }
- return nil
-}
-
-func (*UpdateSchemas20220705) Version() uint64 {
- return 20220705141638
-}
-
-func (*UpdateSchemas20220705) Name() string {
- return "rename users to accounts, create users, user_accounts, teams,
team_users"
-}
diff --git a/plugins/jira/e2e/changelog_test.go
b/plugins/jira/e2e/changelog_test.go
index 562cd203..e3f67938 100644
--- a/plugins/jira/e2e/changelog_test.go
+++ b/plugins/jira/e2e/changelog_test.go
@@ -27,7 +27,7 @@ import (
"github.com/apache/incubator-devlake/plugins/jira/tasks"
)
-func TestChangelogDataFlow(t *testing.T) {
+func TestIssueChangelogDataFlow(t *testing.T) {
var plugin impl.Jira
dataflowTester := e2ehelper.NewDataFlowTester(t, "jira", plugin)
@@ -83,10 +83,10 @@ func TestChangelogDataFlow(t *testing.T) {
// verify changelog conversion
dataflowTester.ImportCsvIntoTabler("./snapshot_tables/_tool_jira_board_issues_for_changelog.csv",
&models.JiraBoardIssue{})
- dataflowTester.FlushTabler(&ticket.Changelog{})
+ dataflowTester.FlushTabler(&ticket.IssueChangelogs{})
dataflowTester.Subtask(tasks.ConvertIssueChangelogsMeta, taskData)
dataflowTester.VerifyTable(
- ticket.Changelog{},
+ ticket.IssueChangelogs{},
"./snapshot_tables/issue_changelogs.csv",
[]string{
"id",
diff --git a/plugins/jira/tasks/issue_changelog_convertor.go
b/plugins/jira/tasks/issue_changelog_convertor.go
index 0b70eada..84a29146 100644
--- a/plugins/jira/tasks/issue_changelog_convertor.go
+++ b/plugins/jira/tasks/issue_changelog_convertor.go
@@ -93,7 +93,7 @@ func ConvertIssueChangelogs(taskCtx core.SubTaskContext)
error {
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, error) {
row := inputRow.(*IssueChangelogItemResult)
- changelog := &ticket.Changelog{
+ changelog := &ticket.IssueChangelogs{
DomainEntity: domainlayer.DomainEntity{Id:
changelogIdGenerator.Generate(
row.ConnectionId,
row.ChangelogId,
diff --git a/plugins/tapd/e2e/bug_changelog_test.go
b/plugins/tapd/e2e/bug_changelog_test.go
index c8db46d7..25e0657f 100644
--- a/plugins/tapd/e2e/bug_changelog_test.go
+++ b/plugins/tapd/e2e/bug_changelog_test.go
@@ -87,11 +87,11 @@ func TestTapdBugChangelogDataFlow(t *testing.T) {
},
)
- dataflowTester.FlushTabler(&ticket.Changelog{})
+ dataflowTester.FlushTabler(&ticket.IssueChangelogs{})
dataflowTester.Subtask(tasks.ConvertBugChangelogMeta, taskData)
dataflowTester.VerifyTable(
- ticket.Changelog{},
- fmt.Sprintf("./snapshot_tables/%s_bug.csv",
ticket.Changelog{}.TableName()),
+ ticket.IssueChangelogs{},
+ fmt.Sprintf("./snapshot_tables/%s_bug.csv",
ticket.IssueChangelogs{}.TableName()),
[]string{
"_raw_data_params",
"_raw_data_table",
diff --git a/plugins/tapd/e2e/story_changelog_test.go
b/plugins/tapd/e2e/story_changelog_test.go
index 2bac9414..6cd7347c 100644
--- a/plugins/tapd/e2e/story_changelog_test.go
+++ b/plugins/tapd/e2e/story_changelog_test.go
@@ -89,11 +89,11 @@ func TestTapdStoryChangelogDataFlow(t *testing.T) {
},
)
- dataflowTester.FlushTabler(&ticket.Changelog{})
+ dataflowTester.FlushTabler(&ticket.IssueChangelogs{})
dataflowTester.Subtask(tasks.ConvertStoryChangelogMeta, taskData)
dataflowTester.VerifyTable(
- ticket.Changelog{},
- fmt.Sprintf("./snapshot_tables/%s_story.csv",
ticket.Changelog{}.TableName()),
+ ticket.IssueChangelogs{},
+ fmt.Sprintf("./snapshot_tables/%s_story.csv",
ticket.IssueChangelogs{}.TableName()),
[]string{
"id",
"_raw_data_params",
diff --git a/plugins/tapd/tasks/bug_changelog_converter.go
b/plugins/tapd/tasks/bug_changelog_converter.go
index 60b2d6eb..2bbaef3d 100644
--- a/plugins/tapd/tasks/bug_changelog_converter.go
+++ b/plugins/tapd/tasks/bug_changelog_converter.go
@@ -79,7 +79,7 @@ func ConvertBugChangelog(taskCtx core.SubTaskContext) error {
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, error) {
cl := inputRow.(*BugChangelogItemResult)
- domainCl := &ticket.Changelog{
+ domainCl := &ticket.IssueChangelogs{
DomainEntity: domainlayer.DomainEntity{
Id:
clIdGen.Generate(data.Options.ConnectionId, cl.Id, cl.Field),
},
diff --git a/plugins/tapd/tasks/story_changelog_converter.go
b/plugins/tapd/tasks/story_changelog_converter.go
index b8c3ed02..bb83573c 100644
--- a/plugins/tapd/tasks/story_changelog_converter.go
+++ b/plugins/tapd/tasks/story_changelog_converter.go
@@ -82,7 +82,7 @@ func ConvertStoryChangelog(taskCtx core.SubTaskContext) error
{
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, error) {
cl := inputRow.(*StoryChangelogItemResult)
- domainCl := &ticket.Changelog{
+ domainCl := &ticket.IssueChangelogs{
DomainEntity: domainlayer.DomainEntity{
Id: fmt.Sprintf("%s:%s",
clIdGen.Generate(data.Options.ConnectionId, cl.Id), cl.Field),
},
diff --git a/plugins/tapd/tasks/task_changelog_converter.go
b/plugins/tapd/tasks/task_changelog_converter.go
index 1b383890..7dd79098 100644
--- a/plugins/tapd/tasks/task_changelog_converter.go
+++ b/plugins/tapd/tasks/task_changelog_converter.go
@@ -82,7 +82,7 @@ func ConvertTaskChangelog(taskCtx core.SubTaskContext) error {
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, error) {
cl := inputRow.(*TaskChangelogItemResult)
- domainCl := &ticket.Changelog{
+ domainCl := &ticket.IssueChangelogs{
DomainEntity: domainlayer.DomainEntity{
Id: fmt.Sprintf("%s:%s",
clIdGen.Generate(data.Options.ConnectionId, cl.Id), cl.Field),
},