klesh commented on code in PR #6499:
URL: 
https://github.com/apache/incubator-devlake/pull/6499#discussion_r1410258143


##########
backend/core/models/domainlayer/devops/common.go:
##########
@@ -0,0 +1,27 @@
+/*
+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 devops
+
+import "time"
+
+type ItemDateInfo struct {

Review Comment:
   In that case, How about `TaskDates` because all of those structs are 
Task-alike. 
   and all of the fields are task-related. `Item` is too general.



##########
backend/core/models/migrationscripts/20231122_add_some_date_field_in_devops_tables.go:
##########
@@ -0,0 +1,88 @@
+/*
+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 (
+       "github.com/apache/incubator-devlake/core/context"
+       "github.com/apache/incubator-devlake/core/errors"
+       "github.com/apache/incubator-devlake/core/plugin"
+       "time"
+)
+
+var _ plugin.MigrationScript = (*addSomeDateFieldsToDevopsTables)(nil)
+
+type cicdDeployment20231122 struct {
+       QueuedDate *time.Time
+}
+
+func (cicdDeployment20231122) TableName() string {
+       return "cicd_deployments"
+}
+
+type cicdDeploymentCommit20231122 struct {
+       QueuedDate *time.Time
+}
+
+func (cicdDeploymentCommit20231122) TableName() string {
+       return "cicd_deployment_commits"
+}
+
+type cicdPipeline20231122 struct {
+       StartedDate *time.Time
+       QueuedDate  *time.Time
+}
+
+func (cicdPipeline20231122) TableName() string {
+       return "cicd_pipelines"
+}
+
+type cicdTask20231122 struct {
+       CreatedDate time.Time
+       QueuedDate  *time.Time
+}
+
+func (cicdTask20231122) TableName() string {
+       return "cicd_tasks"
+}
+
+type addSomeDateFieldsToDevopsTables struct{}
+
+func (u *addSomeDateFieldsToDevopsTables) Up(basicRes context.BasicRes) 
errors.Error {
+       db := basicRes.GetDal()
+       if err := db.AutoMigrate(&cicdPipeline20231122{}); err != nil {

Review Comment:
   
https://github.com/apache/incubator-devlake/blob/63263ca8cf9d3ea916cbe343367968a2db84b44b/backend/helpers/migrationhelper/migrationhelper.go#L35
   you may like to take a look at this helper, it migrates multiple tables at 
once



##########
backend/core/models/migrationscripts/20231128_add_queued_duration_sec_field_in_devops_tables.go:
##########
@@ -0,0 +1,85 @@
+/*
+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 (
+       "github.com/apache/incubator-devlake/core/context"
+       "github.com/apache/incubator-devlake/core/errors"
+       "github.com/apache/incubator-devlake/core/plugin"
+)
+
+var _ plugin.MigrationScript = (*addSomeDateFieldsToDevopsTables)(nil)
+
+type cicdDeployment20231128 struct {
+       QueuedDurationSec *float64
+}
+
+func (cicdDeployment20231128) TableName() string {
+       return "cicd_deployments"
+}
+
+type cicdDeploymentCommit20231128 struct {
+       QueuedDurationSec *float64
+}
+
+func (cicdDeploymentCommit20231128) TableName() string {
+       return "cicd_deployment_commits"
+}
+
+type cicdPipeline20231128 struct {
+       QueuedDurationSec *float64
+}
+
+func (cicdPipeline20231128) TableName() string {
+       return "cicd_pipelines"
+}
+
+type cicdTask20231128 struct {
+       QueuedDurationSec *float64
+}
+
+func (cicdTask20231128) TableName() string {
+       return "cicd_tasks"
+}
+
+type addQueuedDurationSecFieldToDevopsTables struct{}
+
+func (u *addQueuedDurationSecFieldToDevopsTables) Up(basicRes 
context.BasicRes) errors.Error {
+       db := basicRes.GetDal()
+       if err := db.AutoMigrate(&cicdPipeline20231128{}); err != nil {

Review Comment:
   same as above



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to