Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix:#1728 if give list databases then sync all (#1751)

suiyueanran6117ccb511d1
diff --git a/plugin/db/pg/sync.go b/plugin/db/pg/sync.go
index f811958fe9..9dd8f382bc 100644
--- a/plugin/db/pg/sync.go
+++ b/plugin/db/pg/sync.go
@@ -146,15 +146,17 @@ func (driver *Driver) SyncSchema(ctx context.Context, databaseList ...string) ([
if _, ok := excludedDatabaseList[dbName]; ok {
continue
}
- exists := false
- for _, k := range databaseList {
- if dbName == k {
- exists = true
- break
+ if len(databaseList) != 0 {
+ exists := false
+ for _, k := range databaseList {
+ if dbName == k {
+ exists = true
+ break
+ }
+ }
+ if !exists {
+ continue
}
- }
- if !exists {
- continue
}
var schema db.Schema
diff --git a/plugin/db/snowflake/sync.go b/plugin/db/snowflake/sync.go
index df3929e08a..dd83c280e1 100644
--- a/plugin/db/snowflake/sync.go
+++ b/plugin/db/snowflake/sync.go
@@ -72,15 +72,17 @@ func (driver *Driver) SyncSchema(ctx context.Context, databaseList ...string) ([
if database == bytebaseDatabase {
continue
}
- exists := false
- for _, k := range databaseList {
- if database == k {
- exists = true
- break
+ if len(databaseList) != 0 {
+ exists := false
+ for _, k := range databaseList {
+ if database == k {
+ exists = true
+ break
+ }
+ }
+ if !exists {
+ continue
}
- }
- if !exists {
- continue
}
var schema db.Schema
diff --git a/plugin/db/sqlite/sync.go b/plugin/db/sqlite/sync.go
index ad93e0e4fd..8fa43d6bf7 100644
--- a/plugin/db/sqlite/sync.go
+++ b/plugin/db/sqlite/sync.go
@@ -64,15 +64,17 @@ func (driver *Driver) SyncSchema(ctx context.Context, databaseList ...string) ([
if _, ok := excludedDatabaseList[dbName]; ok {
continue
}
- exists := false
- for _, k := range databaseList {
- if dbName == k {
- exists = true
- break
+ if len(databaseList) != 0 {
+ exists := false
+ for _, k := range databaseList {
+ if dbName == k {
+ exists = true
+ break
+ }
+ }
+ if !exists {
+ continue
}
- }
- if !exists {
- continue
}
var schema db.Schema