This is an automated email from the ASF dual-hosted git repository.
hez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 142d56edc refactor: Rename state table used by Singer framework (#4636)
142d56edc is described below
commit 142d56edc9e04bd45c181a8aae5a131152fdf1cf
Author: Keon Amini <[email protected]>
AuthorDate: Wed Apr 5 20:35:50 2023 -0500
refactor: Rename state table used by Singer framework (#4636)
* refactor: rename collector state table for singer taps
* refactor: rename singer-tap table from _devlake_collector_state to
_devlake_collector_tap_state
---
.../20230405_rename_tap_collector_state.go | 45 ++++++++++++++++++++++
backend/core/models/migrationscripts/register.go | 1 +
backend/helpers/pluginhelper/tap/models.go | 2 +-
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git
a/backend/core/models/migrationscripts/20230405_rename_tap_collector_state.go
b/backend/core/models/migrationscripts/20230405_rename_tap_collector_state.go
new file mode 100644
index 000000000..e9a895d76
--- /dev/null
+++
b/backend/core/models/migrationscripts/20230405_rename_tap_collector_state.go
@@ -0,0 +1,45 @@
+/*
+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 = (*renameCollectorTapStateTable)(nil)
+
+type renameCollectorTapStateTable struct{}
+
+func (*renameCollectorTapStateTable) Up(basicRes context.BasicRes)
errors.Error {
+ db := basicRes.GetDal()
+ err := db.RenameTable("_devlake_collector_state",
"_devlake_collector_tap_state")
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+func (*renameCollectorTapStateTable) Version() uint64 {
+ return 20230405000001
+}
+
+func (*renameCollectorTapStateTable) Name() string {
+ return "Rename Collector state table for Singer Taps"
+}
diff --git a/backend/core/models/migrationscripts/register.go
b/backend/core/models/migrationscripts/register.go
index a09acdbeb..159cc9821 100644
--- a/backend/core/models/migrationscripts/register.go
+++ b/backend/core/models/migrationscripts/register.go
@@ -75,5 +75,6 @@ func All() []plugin.MigrationScript {
new(addCommitShaIndex),
new(removeCreatedDateAfterFromCollectorMeta20230223),
new(addHostNamespaceRepoName),
+ new(renameCollectorTapStateTable),
}
}
diff --git a/backend/helpers/pluginhelper/tap/models.go
b/backend/helpers/pluginhelper/tap/models.go
index 5b1bf9599..37e121516 100644
--- a/backend/helpers/pluginhelper/tap/models.go
+++ b/backend/helpers/pluginhelper/tap/models.go
@@ -58,7 +58,7 @@ type (
// TableName the table name
func (*RawState) TableName() string {
- return "_devlake_collector_state"
+ return "_devlake_collector_tap_state"
}
// FromState converts State to RawState