You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/13 16:15:44 UTC

[GitHub] [incubator-devlake] mappjzc opened a new pull request, #3062: Commit file

mappjzc opened a new pull request, #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062

   # Summary
   changed file_path from 255 to text
   changed id fromcommitsha and path to commtsha and sha path
   changed domainlayer and common to be archived
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Does this close any open issues?
   Closes #2949 
   Closes #3060 
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r972506767


##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,195 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+	"strings"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"

Review Comment:
   This is problematic. We shouldn't have a gitlab-specific under the models/migrationscripts. This is where the datasource-agnostic migrations take place.
   
   If I were to turn off the gitlab plugin, I get a panic because [this line](https://github.com/apache/incubator-devlake/blob/e43b9d70203759ddbe97205f29aeb63106c50d34/plugins/gitlab/api/init.go#L30), which sets the BasicRes global variable, will not run. Either BasicRes has to be set independently of gitlab (different package outside of plugins/), or this migration needs to be moved to the [gitlab migrations package](https://github.com/apache/incubator-devlake/tree/main/plugins/gitlab/models/migrationscripts)



##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,195 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+	"strings"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"

Review Comment:
   This is problematic. We shouldn't have a gitlab-specific reference under the models/migrationscripts. This is where the datasource-agnostic migrations take place.
   
   If I were to turn off the gitlab plugin, I get a panic because [this line](https://github.com/apache/incubator-devlake/blob/e43b9d70203759ddbe97205f29aeb63106c50d34/plugins/gitlab/api/init.go#L30), which sets the BasicRes global variable, will not run. Either BasicRes has to be set independently of gitlab (different package outside of plugins/), or this migration needs to be moved to the [gitlab migrations package](https://github.com/apache/incubator-devlake/tree/main/plugins/gitlab/models/migrationscripts)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r969913397


##########
plugins/jira/models/migrationscripts/20220505_rename_source_table.go:
##########
@@ -43,7 +44,7 @@ func (JiraConnectionV010) TableName() string {
 type renameSourceTable struct{}
 
 func (*renameSourceTable) Up(ctx context.Context, db *gorm.DB) error {
-	err := db.Migrator().RenameTable(archived.JiraSource{}, JiraConnectionV010{})
+	err := db.Migrator().RenameTable(jiraArchived.JiraSource{}, JiraConnectionV010{})

Review Comment:
   You can create a struct with tableName ‘jira_source’ instead of using jiraArchived



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mappjzc commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
mappjzc commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r971486079


##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,191 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+	"strings"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"gorm.io/gorm"
+)
+
+type CommitFileAddLength struct {
+	archived.DomainEntity
+	CommitSha string `gorm:"type:varchar(40)"`
+	FilePath  string `gorm:"type:text"`
+	Additions int
+	Deletions int
+}
+
+func (CommitFileAddLength) TableName() string {
+	return "commit_files"
+}
+
+type CommitFileAddLengthBak struct {
+	archived.DomainEntity
+	CommitSha string `gorm:"type:varchar(40)"`
+	FilePath  string `gorm:"type:varchar(255)"`
+	Additions int
+	Deletions int
+}
+
+func (CommitFileAddLengthBak) TableName() string {
+	return "commit_files_bak"
+}
+
+type CommitFileComponentBak struct {
+	archived.NoPKModel
+	CommitFileId  string `gorm:"primaryKey;type:varchar(255)"`
+	ComponentName string `gorm:"type:varchar(255)"`
+}
+
+func (CommitFileComponentBak) TableName() string {
+	return "commit_file_components_bak"
+}
+
+type addCommitFilePathLength struct{}
+
+func (*addCommitFilePathLength) Up(ctx context.Context, db *gorm.DB) errors.Error {
+	err := db.Migrator().RenameTable(&CommitFile{}, &CommitFileAddLengthBak{})
+	if err != nil {
+		return errors.Default.Wrap(err, "error no rename commit_file to commit_files_bak")
+	}
+
+	err = db.Migrator().AutoMigrate(&CommitFileAddLength{})
+	if err != nil {
+		return errors.Default.Wrap(err, "error on auto migrate commit_file")
+	}
+
+	// update old id to new id and write to the new table
+	cursor, err := db.Model(&CommitFileAddLengthBak{}).Rows()
+	if err != nil {
+		return errors.Default.Wrap(err, "error on select CommitFileAddLength")
+	}
+	defer cursor.Close()
+
+	batch, err := helper.NewBatchSave(api.BasicRes, reflect.TypeOf(&CommitFileAddLength{}), 200)
+	if err != nil {
+		return errors.Default.Wrap(err, "error getting batch from table commit_file")
+	}
+
+	defer batch.Close()
+	for cursor.Next() {

Review Comment:
   on two core host, 5200 times per second.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r971465409


##########
plugins/gitextractor/parser/repo.go:
##########
@@ -329,15 +332,20 @@ func (r *GitRepo) storeCommitFilesFromDiff(commitSha string, diff *git.Diff, com
 		commitFile = new(code.CommitFile)
 		commitFile.CommitSha = commitSha
 		commitFile.FilePath = file.NewFile.Path
-		commitFile.Id = commitSha + ":" + file.NewFile.Path
+
+		// use commitSha and the sha256 of FilePath to create id
+		shaFilePath := sha256.New()
+		shaFilePath.Write([]byte(file.NewFile.Path))
+		commitFile.Id = commitSha + ":" + hex.EncodeToString(shaFilePath.Sum(nil))

Review Comment:
   can you comment on why you are doing this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mappjzc commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
mappjzc commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r971476180


##########
plugins/gitextractor/parser/repo.go:
##########
@@ -329,15 +332,20 @@ func (r *GitRepo) storeCommitFilesFromDiff(commitSha string, diff *git.Diff, com
 		commitFile = new(code.CommitFile)
 		commitFile.CommitSha = commitSha
 		commitFile.FilePath = file.NewFile.Path
-		commitFile.Id = commitSha + ":" + file.NewFile.Path
+
+		// use commitSha and the sha256 of FilePath to create id
+		shaFilePath := sha256.New()
+		shaFilePath.Write([]byte(file.NewFile.Path))
+		commitFile.Id = commitSha + ":" + hex.EncodeToString(shaFilePath.Sum(nil))

Review Comment:
   Because of issue https://github.com/apache/incubator-devlake/issues/2949
   With some long path,the varchar(255) was not enough both ID and file_path
   So we use the hash to compress the path in ID and add length of file_path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r972506767


##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,195 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+	"strings"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"

Review Comment:
   This is problematic. We shouldn't have a gitlab-specific reference under the models/migrationscripts package. This is where the datasource-agnostic migrations take place.
   
   If I were to turn off the gitlab plugin, I get a panic because [this line](https://github.com/apache/incubator-devlake/blob/e43b9d70203759ddbe97205f29aeb63106c50d34/plugins/gitlab/api/init.go#L30), which sets the BasicRes global variable, will not run. Either BasicRes has to be set independently of gitlab (different package outside of plugins/), or this migration needs to be moved to the [gitlab migrations package](https://github.com/apache/incubator-devlake/tree/main/plugins/gitlab/models/migrationscripts)



##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,195 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+	"strings"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"

Review Comment:
   This is problematic. We shouldn't have a gitlab-specific reference under the models/migrationscripts package. This is where the datasource-agnostic migrations take place.
   
   If I were to turn off the gitlab plugin, I get a panic because of [this line](https://github.com/apache/incubator-devlake/blob/e43b9d70203759ddbe97205f29aeb63106c50d34/plugins/gitlab/api/init.go#L30), which sets the BasicRes global variable, will not run. Either BasicRes has to be set independently of gitlab (different package outside of plugins/), or this migration needs to be moved to the [gitlab migrations package](https://github.com/apache/incubator-devlake/tree/main/plugins/gitlab/models/migrationscripts)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r971496518


##########
plugins/gitextractor/parser/repo.go:
##########
@@ -329,15 +332,20 @@ func (r *GitRepo) storeCommitFilesFromDiff(commitSha string, diff *git.Diff, com
 		commitFile = new(code.CommitFile)
 		commitFile.CommitSha = commitSha
 		commitFile.FilePath = file.NewFile.Path
-		commitFile.Id = commitSha + ":" + file.NewFile.Path
+
+		// use commitSha and the sha256 of FilePath to create id
+		shaFilePath := sha256.New()
+		shaFilePath.Write([]byte(file.NewFile.Path))
+		commitFile.Id = commitSha + ":" + hex.EncodeToString(shaFilePath.Sum(nil))

Review Comment:
   please add `With some long path,the varchar(255) was not enough both ID and file_path
   So we use the hash to compress the path in ID and add length of file_path.` to code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mappjzc merged pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
mappjzc merged PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r970519472


##########
plugins/gitextractor/parser/repo.go:
##########
@@ -329,7 +332,12 @@ func (r *GitRepo) storeCommitFilesFromDiff(commitSha string, diff *git.Diff, com
 		commitFile = new(code.CommitFile)
 		commitFile.CommitSha = commitSha
 		commitFile.FilePath = file.NewFile.Path
-		commitFile.Id = commitSha + ":" + file.NewFile.Path
+
+		// use commitSha and the sha256 of FilePath to create id
+		ShaFilePath := sha256.New()
+		ShaFilePath.Write([]byte(file.NewFile.Path))
+		commitFile.Id = commitSha + ":" + hex.EncodeToString(ShaFilePath.Sum(nil))

Review Comment:
   Can you comment why are you creating ShaFilePath like this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r971466348


##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,191 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+	"strings"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"gorm.io/gorm"
+)
+
+type CommitFileAddLength struct {
+	archived.DomainEntity
+	CommitSha string `gorm:"type:varchar(40)"`
+	FilePath  string `gorm:"type:text"`
+	Additions int
+	Deletions int
+}
+
+func (CommitFileAddLength) TableName() string {
+	return "commit_files"
+}
+
+type CommitFileAddLengthBak struct {
+	archived.DomainEntity
+	CommitSha string `gorm:"type:varchar(40)"`
+	FilePath  string `gorm:"type:varchar(255)"`
+	Additions int
+	Deletions int
+}
+
+func (CommitFileAddLengthBak) TableName() string {
+	return "commit_files_bak"
+}
+
+type CommitFileComponentBak struct {
+	archived.NoPKModel
+	CommitFileId  string `gorm:"primaryKey;type:varchar(255)"`
+	ComponentName string `gorm:"type:varchar(255)"`
+}
+
+func (CommitFileComponentBak) TableName() string {
+	return "commit_file_components_bak"
+}
+
+type addCommitFilePathLength struct{}
+
+func (*addCommitFilePathLength) Up(ctx context.Context, db *gorm.DB) errors.Error {
+	err := db.Migrator().RenameTable(&CommitFile{}, &CommitFileAddLengthBak{})
+	if err != nil {
+		return errors.Default.Wrap(err, "error no rename commit_file to commit_files_bak")
+	}
+
+	err = db.Migrator().AutoMigrate(&CommitFileAddLength{})
+	if err != nil {
+		return errors.Default.Wrap(err, "error on auto migrate commit_file")
+	}
+
+	// update old id to new id and write to the new table
+	cursor, err := db.Model(&CommitFileAddLengthBak{}).Rows()
+	if err != nil {
+		return errors.Default.Wrap(err, "error on select CommitFileAddLength")
+	}
+	defer cursor.Close()
+
+	batch, err := helper.NewBatchSave(api.BasicRes, reflect.TypeOf(&CommitFileAddLength{}), 200)
+	if err != nil {
+		return errors.Default.Wrap(err, "error getting batch from table commit_file")
+	}
+
+	defer batch.Close()
+	for cursor.Next() {

Review Comment:
   Have you calculated how long does this whole process cost for a project like devlake?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3062: Commit file

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r970517305


##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,116 @@
+/*
+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"
+	"crypto/sha256"
+	"encoding/hex"
+	"reflect"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/gitlab/api"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"gorm.io/gorm"
+)
+
+type CommitFileAddLength struct {
+	archived.DomainEntity
+	CommitSha string `gorm:"type:varchar(40)"`
+	FilePath  string `gorm:"type:text"`
+	Additions int
+	Deletions int
+}
+
+func (CommitFileAddLength) TableName() string {
+	return "commit_files"
+}
+
+type CommitFileAddLengthBak struct {
+	archived.DomainEntity
+	CommitSha string `gorm:"type:varchar(40)"`
+	FilePath  string `gorm:"type:varchar(255)"`
+	Additions int
+	Deletions int
+}
+
+func (CommitFileAddLengthBak) TableName() string {
+	return "commit_files_bak"
+}
+
+type addCommitFilePathLength struct{}
+
+func (*addCommitFilePathLength) Up(ctx context.Context, db *gorm.DB) errors.Error {

Review Comment:
   Please refer to plugins/gitlab/models/migrationscripts/20220906_fix_duration_to_float8.go



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org