-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-5643' of github.com:merico-dev/lake into fix-5643
- Loading branch information
Showing
12 changed files
with
177 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...itbucket/models/migrationscripts/20231123_add_primary_key_for_bitbucket_pipeline_steps.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
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/models/migrationscripts/archived" | ||
"github.com/apache/incubator-devlake/core/plugin" | ||
"time" | ||
) | ||
|
||
var _ plugin.MigrationScript = (*reCreatBitBucketPipelineSteps)(nil) | ||
|
||
type bitbucketPipelineStep20231123 struct { | ||
ConnectionId uint64 `gorm:"primaryKey"` | ||
BitbucketId string `gorm:"primaryKey"` | ||
PipelineId string `gorm:"type:varchar(255)"` | ||
Name string `gorm:"type:varchar(255)"` | ||
Trigger string `gorm:"type:varchar(255)"` | ||
State string `gorm:"type:varchar(255)"` | ||
Result string `gorm:"type:varchar(255)"` | ||
RepoId string `gorm:"type:varchar(255)"` | ||
MaxTime int | ||
StartedOn *time.Time | ||
CompletedOn *time.Time | ||
DurationInSeconds int | ||
BuildSecondsUsed int | ||
RunNumber int | ||
Type string `gorm:"type:varchar(255)"` | ||
Environment string `gorm:"type:varchar(255)"` | ||
archived.NoPKModel | ||
} | ||
|
||
func (bitbucketPipelineStep20231123) TableName() string { | ||
return "_tool_bitbucket_pipeline_steps" | ||
} | ||
|
||
type reCreatBitBucketPipelineSteps struct{} | ||
|
||
func (script *reCreatBitBucketPipelineSteps) Up(basicRes context.BasicRes) errors.Error { | ||
db := basicRes.GetDal() | ||
if err := db.DropTables(bitbucketPipelineStep20231123{}.TableName()); err != nil { | ||
return err | ||
} | ||
return db.AutoMigrate(&bitbucketPipelineStep20231123{}) | ||
} | ||
|
||
func (*reCreatBitBucketPipelineSteps) Version() uint64 { | ||
return 20231123160001 | ||
} | ||
|
||
func (script *reCreatBitBucketPipelineSteps) Name() string { | ||
return "re create _tool_bitbucket_pipeline_steps, make sure primary keys exist." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...nd/plugins/teambition/models/migrationscripts/20231123_recreate_teambition_connections.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
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/models/migrationscripts/archived" | ||
"github.com/apache/incubator-devlake/core/plugin" | ||
) | ||
|
||
var _ plugin.MigrationScript = (*reCreateTeambitionConnections)(nil) | ||
|
||
type teambitionConnection20231123 struct { | ||
Name string `gorm:"type:varchar(100);uniqueIndex" json:"name" validate:"required"` | ||
archived.Model | ||
archived.RestConnection `mapstructure:",squash"` | ||
TenantId string `mapstructure:"tenantId" validate:"required" json:"tenantId"` | ||
TenantType string `mapstructure:"tenantType" validate:"required" json:"tenantType"` | ||
} | ||
|
||
func (teambitionConnection20231123) TableName() string { | ||
return "_tool_teambition_connections" | ||
} | ||
|
||
type reCreateTeambitionConnections struct{} | ||
|
||
func (*reCreateTeambitionConnections) Up(basicRes context.BasicRes) errors.Error { | ||
db := basicRes.GetDal() | ||
if err := db.DropTables(teambitionConnection20231123{}.TableName()); err != nil { | ||
return err | ||
} | ||
return db.AutoMigrate(&teambitionConnection20231123{}) | ||
} | ||
|
||
func (*reCreateTeambitionConnections) Version() uint64 { | ||
return 20231123160000 | ||
} | ||
|
||
func (*reCreateTeambitionConnections) Name() string { | ||
return "recreate teambition connection table" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters