Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: use “instance” instead of “database” in the db engine context log (#3588)
Tianzhou (天舟)a78ae3b475ed
diff --git a/plugin/db/clickhouse/migrate.go b/plugin/db/clickhouse/migrate.goindex fd96f8c8c4..fd8acf6013 100644--- a/plugin/db/clickhouse/migrate.go+++ b/plugin/db/clickhouse/migrate.go@@ -45,19 +45,19 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {if setup {log.Info("Bytebase migration schema not found, creating schema...",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)if err := driver.Execute(ctx, migrationSchema, true /* createDatabase */); err != nil {log.Error("Failed to initialize migration schema.",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return util.FormatErrorWithQuery(err, migrationSchema)}log.Info("Successfully created migration schema.",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)}diff --git a/plugin/db/mysql/migrate.go b/plugin/db/mysql/migrate.goindex 0398ec3e89..cee3db6605 100644--- a/plugin/db/mysql/migrate.go+++ b/plugin/db/mysql/migrate.go@@ -44,7 +44,7 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {if setup {log.Info("Bytebase migration schema not found, creating schema...",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)// Do not wrap it in a single transaction here because:// 1. For MySQL, each DDL is in its own transaction. See https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html@@ -53,13 +53,13 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {log.Error("Failed to initialize migration schema.",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return util.FormatErrorWithQuery(err, migrationSchema)}log.Info("Successfully created migration schema.",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)}diff --git a/plugin/db/pg/migrate.go b/plugin/db/pg/migrate.goindex 5ad6581667..8425a6f5fd 100644--- a/plugin/db/pg/migrate.go+++ b/plugin/db/pg/migrate.go@@ -59,7 +59,7 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {if setup {log.Info("Bytebase migration schema not found, creating schema...",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)// Only try to create `bytebase` db when user provide an instance@@ -69,7 +69,7 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {log.Error("Failed to find database \"bytebase\".",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return errors.Wrap(err, "failed to find database \"bytebase\"")}@@ -80,7 +80,7 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {log.Error("Failed to create database \"bytebase\".",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return util.FormatErrorWithQuery(err, createBytebaseDatabaseStmt)}@@ -90,7 +90,7 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {log.Error("Failed to switch to database \"bytebase\".",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return errors.Wrap(err, "failed to switch to database \"bytebase\"")}@@ -101,13 +101,13 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {log.Error("Failed to initialize migration schema.",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return util.FormatErrorWithQuery(err, migrationSchema)}log.Info("Successfully created migration schema.",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)}diff --git a/plugin/db/snowflake/migrate.go b/plugin/db/snowflake/migrate.goindex b572c54b2e..0f68f10437 100644--- a/plugin/db/snowflake/migrate.go+++ b/plugin/db/snowflake/migrate.go@@ -52,20 +52,20 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {if setup {log.Info("Bytebase migration schema not found, creating schema...",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)// Should use role SYSADMIN.if err := driver.Execute(ctx, migrationSchema, true /* createDatabase */); err != nil {log.Error("Failed to initialize migration schema.",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return util.FormatErrorWithQuery(err, migrationSchema)}log.Info("Successfully created migration schema.",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)}diff --git a/plugin/db/sqlite/migrate.go b/plugin/db/sqlite/migrate.goindex 1408786fd9..b9cd74c282 100644--- a/plugin/db/sqlite/migrate.go+++ b/plugin/db/sqlite/migrate.go@@ -56,14 +56,14 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {if setup {log.Info("Bytebase migration schema not found, creating schema...",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)if _, err := driver.GetDBConnection(ctx, bytebaseDatabase); err != nil {log.Error("Failed to switch to database \"bytebase\".",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return errors.Wrap(err, "failed to switch to database \"bytebase\"")}@@ -72,13 +72,13 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {log.Error("Failed to initialize migration schema.",zap.Error(err),zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)return util.FormatErrorWithQuery(err, migrationSchema)}log.Info("Successfully created migration schema.",zap.String("environment", driver.connectionCtx.EnvironmentName),- zap.String("database", driver.connectionCtx.InstanceName),+ zap.String("instance", driver.connectionCtx.InstanceName),)}