You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "abeizn (via GitHub)" <gi...@apache.org> on 2023/09/04 06:17:21 UTC
[GitHub] [incubator-devlake] abeizn commented on a diff in pull request #6006: refactor: convert bp.settings into multiple tables
abeizn commented on code in PR #6006:
URL: https://github.com/apache/incubator-devlake/pull/6006#discussion_r1314475652
##########
backend/core/models/migrationscripts/20230829_normalize_bp_settings.go:
##########
@@ -0,0 +1,120 @@
+/*
+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 (
+ "encoding/json"
+ "time"
+
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/dal"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/models/migrationscripts/archived"
+ "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+)
+
+var _ plugin.MigrationScript = (*normalizeBpSettings)(nil)
+
+type normalizeBpSettings struct{}
+
+type blueprint20230829 struct {
+ ID uint64 `gorm:"primaryKey"`
+ Settings string
+ BeforePlan json.RawMessage
+ AfterPlan json.RawMessage
+ TimeAfter *time.Time
+}
+
+func (blueprint20230829) TableName() string {
+ return "_devlake_blueprints"
+}
+
+type blueprintSettings20230829 struct {
+ BeforePlan json.RawMessage `json:"before_plan"`
+ AfterPlan json.RawMessage `json:"after_plan"`
+ TimeAfter *archived.Iso8601Time `json:"timeAfter"`
+ Connections []struct {
+ Plugin string `json:"plugin"`
+ ConnectionID uint64 `json:"connectionId"`
+ Scopes []struct {
+ ID string `json:"id"`
+ } `json:"scopes"`
+ } `json:"connections"`
+}
+
+func (script *normalizeBpSettings) Up(basicRes context.BasicRes) errors.Error {
+ err := migrationhelper.AutoMigrateTables(
+ basicRes,
+ new(blueprint20230829),
+ new(archived.BlueprintConnection),
+ new(archived.BlueprintScope),
+ )
+ if err != nil {
+ return err
+ }
+ encKey := basicRes.GetConfig(plugin.EncodeKeyEnvStr)
+ if encKey == "" {
+ return errors.BadInput.New("jira v0.11 invalid encKey")
Review Comment:
jira v0.11 ?
##########
backend/core/services/pipeline_service.go:
##########
@@ -0,0 +1,37 @@
+/*
+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 services
+
+import (
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/models"
+)
+
+// PipelineQuery is a query for GetPipelines
+// type PipelineQuery struct {
+// Pagination
+// Label string `form:"label"`
+// }
+
+type PipelineService interface {
+ Create(bp *models.NewPipeline) (*models.Pipeline, errors.Error)
+ // Query(query *PipelineQuery) (*Paginated[PipelineQuery], errors.Error)
+ // Get(id uint64) (*models.Pipeline, errors.Error)
Review Comment:
Are these interfaces unnecessary?
--
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