You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2022/10/18 08:07:54 UTC
[incubator-devlake] branch main updated (4b5084c2 -> 76a5f098)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
from 4b5084c2 refactor: update docker-compose config ui default password (#3461)
new 17b01f25 docs: add comments and rename scripts
new 76a5f098 docs: add issue line for change_leadtimeminutes_to_int64
The 2 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/migrationscripts/20220406_add_frame_tables.go | 1 +
.../20220505_rename_pipeline_step_to_stage.go | 1 +
models/migrationscripts/20220616_add_blueprint_mode.go | 1 +
.../migrationscripts/20220913_fix_commitfile_id_toolong.go | 4 ++++
...nutes.go => 20220929_change_leadtimeminutes_to_int64.go} | 13 ++++++++-----
models/migrationscripts/register.go | 2 +-
6 files changed, 16 insertions(+), 6 deletions(-)
rename models/migrationscripts/{20220929_modify_lead_time_minutes.go => 20220929_change_leadtimeminutes_to_int64.go} (79%)
[incubator-devlake] 01/02: docs: add comments and rename scripts
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 17b01f25f604547d18ffed6ee95d9bc34b7509cf
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Tue Oct 18 15:17:05 2022 +0800
docs: add comments and rename scripts
---
models/migrationscripts/20220406_add_frame_tables.go | 1 +
.../20220505_rename_pipeline_step_to_stage.go | 1 +
models/migrationscripts/20220616_add_blueprint_mode.go | 1 +
.../migrationscripts/20220913_fix_commitfile_id_toolong.go | 4 ++++
...inutes.go => 20220929_change_leadtimeminutes_to_int64.go} | 12 +++++++-----
models/migrationscripts/register.go | 2 +-
6 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/models/migrationscripts/20220406_add_frame_tables.go b/models/migrationscripts/20220406_add_frame_tables.go
index 3e014b54..6800a892 100644
--- a/models/migrationscripts/20220406_add_frame_tables.go
+++ b/models/migrationscripts/20220406_add_frame_tables.go
@@ -30,6 +30,7 @@ var _ core.MigrationScript = (*addFrameworkTables)(nil)
type addFrameworkTables struct{}
func (*addFrameworkTables) Up(basicRes core.BasicRes) errors.Error {
+ // To create multiple tables with migrationhelper
return migrationhelper.AutoMigrateTables(
basicRes,
&archived.Task{},
diff --git a/models/migrationscripts/20220505_rename_pipeline_step_to_stage.go b/models/migrationscripts/20220505_rename_pipeline_step_to_stage.go
index 79d10616..f2b03f9a 100644
--- a/models/migrationscripts/20220505_rename_pipeline_step_to_stage.go
+++ b/models/migrationscripts/20220505_rename_pipeline_step_to_stage.go
@@ -27,6 +27,7 @@ var _ core.MigrationScript = (*renamePipelineStepToStage)(nil)
type renamePipelineStepToStage struct{}
func (*renamePipelineStepToStage) Up(basicRes core.BasicRes) errors.Error {
+ // rename column `step` to `stage` for table `_devlake_pipelines`
return basicRes.GetDal().RenameColumn("_devlake_pipelines", "step", "stage")
}
diff --git a/models/migrationscripts/20220616_add_blueprint_mode.go b/models/migrationscripts/20220616_add_blueprint_mode.go
index 3d7cd319..4c8bce3b 100644
--- a/models/migrationscripts/20220616_add_blueprint_mode.go
+++ b/models/migrationscripts/20220616_add_blueprint_mode.go
@@ -37,6 +37,7 @@ func (blueprint20220616) TableName() string {
type addBlueprintMode struct{}
func (*addBlueprintMode) Up(basicRes core.BasicRes) errors.Error {
+ // Add column `mode` and `is_manual` with default value "ADVANCED" and false to `_devlake_blueprints`
db := basicRes.GetDal()
err := db.AutoMigrate(&blueprint20220616{})
if err != nil {
diff --git a/models/migrationscripts/20220913_fix_commitfile_id_toolong.go b/models/migrationscripts/20220913_fix_commitfile_id_toolong.go
index 70470870..7374d269 100644
--- a/models/migrationscripts/20220913_fix_commitfile_id_toolong.go
+++ b/models/migrationscripts/20220913_fix_commitfile_id_toolong.go
@@ -51,6 +51,10 @@ type commitFileComponent20220913 struct {
}
func (script *fixCommitFileIdTooLong) Up(basicRes core.BasicRes) errors.Error {
+ // To recalculate the primary key values for the `commit_files` since
+ // we used the `FilePath` as part of the primary key which would exceed
+ // the maximum length of the column in some cases.
+ // The purpose of this script is to replace the `FilePath` with its sha1
// migrate main table
err := migrationhelper.TransformTable(
basicRes,
diff --git a/models/migrationscripts/20220929_modify_lead_time_minutes.go b/models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go
similarity index 81%
rename from models/migrationscripts/20220929_modify_lead_time_minutes.go
rename to models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go
index 81bd65ce..d789dc4a 100644
--- a/models/migrationscripts/20220929_modify_lead_time_minutes.go
+++ b/models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go
@@ -23,9 +23,9 @@ import (
"github.com/apache/incubator-devlake/plugins/core/dal"
)
-var _ core.MigrationScript = (*modifyLeadTimeMinutes)(nil)
+var _ core.MigrationScript = (*changeLeadTimeMinutesToInt64)(nil)
-type modifyLeadTimeMinutes struct{}
+type changeLeadTimeMinutesToInt64 struct{}
type Issues20220929 struct {
LeadTimeMinutes int64
@@ -35,7 +35,9 @@ func (Issues20220929) TableName() string {
return "issues"
}
-func (*modifyLeadTimeMinutes) Up(basicRes core.BasicRes) errors.Error {
+func (*changeLeadTimeMinutesToInt64) Up(basicRes core.BasicRes) errors.Error {
+ // Yes, issues.lead_time_minutes might be negative, we ought to change the type
+ // for the column from `uint` to `int64`
db := basicRes.GetDal()
bakColumnName := "lead_time_minutes_20220929"
err := db.RenameColumn("issues", "lead_time_minutes", bakColumnName)
@@ -72,10 +74,10 @@ func (*modifyLeadTimeMinutes) Up(basicRes core.BasicRes) errors.Error {
return nil
}
-func (*modifyLeadTimeMinutes) Version() uint64 {
+func (*changeLeadTimeMinutesToInt64) Version() uint64 {
return 20220929145125
}
-func (*modifyLeadTimeMinutes) Name() string {
+func (*changeLeadTimeMinutesToInt64) Name() string {
return "modify lead_time_minutes"
}
diff --git a/models/migrationscripts/register.go b/models/migrationscripts/register.go
index a862dc24..225da018 100644
--- a/models/migrationscripts/register.go
+++ b/models/migrationscripts/register.go
@@ -49,7 +49,7 @@ func All() []core.MigrationScript {
new(addRawDataOriginToBoardRepos),
new(renamePipelineCommits),
new(commitLineChange),
- new(modifyLeadTimeMinutes),
+ new(changeLeadTimeMinutesToInt64),
new(addRepoSnapshot),
}
}
[incubator-devlake] 02/02: docs: add issue line for change_leadtimeminutes_to_int64
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 76a5f0988cdb96d06567e899e3629a551eea9782
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Tue Oct 18 15:49:01 2022 +0800
docs: add issue line for change_leadtimeminutes_to_int64
---
models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go b/models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go
index d789dc4a..553b4db7 100644
--- a/models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go
+++ b/models/migrationscripts/20220929_change_leadtimeminutes_to_int64.go
@@ -38,6 +38,7 @@ func (Issues20220929) TableName() string {
func (*changeLeadTimeMinutesToInt64) Up(basicRes core.BasicRes) errors.Error {
// Yes, issues.lead_time_minutes might be negative, we ought to change the type
// for the column from `uint` to `int64`
+ // related issue: https://github.com/apache/incubator-devlake/issues/3224
db := basicRes.GetDal()
bakColumnName := "lead_time_minutes_20220929"
err := db.RenameColumn("issues", "lead_time_minutes", bakColumnName)