Skip to content

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

chore: clean up db driver install (#992)

qsliu0d52aaa5c0ff
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.go
index c08969f2d2..6ae60dae18 100644
--- a/bin/server/cmd/root.go
+++ b/bin/server/cmd/root.go
@@ -24,17 +24,12 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
- // Import sqlite3 driver.
- _ "github.com/mattn/go-sqlite3"
-
// Register clickhouse driver.
_ "github.com/bytebase/bytebase/plugin/db/clickhouse"
// Register mysql driver.
_ "github.com/bytebase/bytebase/plugin/db/mysql"
// Register postgres driver.
_ "github.com/bytebase/bytebase/plugin/db/pg"
- _ "github.com/lib/pq"
-
// Register snowflake driver.
_ "github.com/bytebase/bytebase/plugin/db/snowflake"
// Register sqlite driver.
diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.go
index f4567947b1..53f3b727f6 100644
--- a/plugin/db/pg/pg.go
+++ b/plugin/db/pg/pg.go
@@ -15,6 +15,9 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ // Import pg driver.
+ _ "github.com/lib/pq"
+
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
"go.uber.org/zap"
diff --git a/plugin/db/sqlite/sqlite.go b/plugin/db/sqlite/sqlite.go
index 114ef2dea3..d4a828bd2d 100644
--- a/plugin/db/sqlite/sqlite.go
+++ b/plugin/db/sqlite/sqlite.go
@@ -13,6 +13,9 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ // Import sqlite3 driver.
+ _ "github.com/mattn/go-sqlite3"
+
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
"go.uber.org/zap"
diff --git a/store/pg_engine.go b/store/pg_engine.go
index 2835545d3b..f67c1c55c1 100644
--- a/store/pg_engine.go
+++ b/store/pg_engine.go
@@ -15,6 +15,9 @@ import (
"github.com/blang/semver/v4"
dbdriver "github.com/bytebase/bytebase/plugin/db"
+ // Register postgres driver.
+ _ "github.com/bytebase/bytebase/plugin/db/pg"
+
"github.com/bytebase/bytebase/common"
"go.uber.org/zap"
)
diff --git a/store/pg_engine_test.go b/store/pg_engine_test.go
index 1711e91766..21c6841f20 100644
--- a/store/pg_engine_test.go
+++ b/store/pg_engine_test.go
@@ -14,9 +14,6 @@ import (
"github.com/bytebase/bytebase/resources/postgres"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
-
- // Register postgres driver
- _ "github.com/bytebase/bytebase/plugin/db/pg"
)
func TestGetMigrationVersions(t *testing.T) {