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: check database exists in ghost (#15276)
boojack07cc0e33871e
diff --git a/backend/plugin/advisor/mysql/advisor_online_migration.go b/backend/plugin/advisor/mysql/advisor_online_migration.goindex 417b03e4eb..7317fc154d 100644--- a/backend/plugin/advisor/mysql/advisor_online_migration.go+++ b/backend/plugin/advisor/mysql/advisor_online_migration.go@@ -17,6 +17,12 @@ import (storepb "github.com/bytebase/bytebase/proto/generated-go/store")+const (+ // The database name to save temporary data for gh-ost.+ // Use backup database name for now.+ ghostDatabaseName = "bbdataarchive"+)+var (_ advisor.Advisor = (*OnlineMigrationAdvisor)(nil))@@ -51,6 +57,21 @@ func (*OnlineMigrationAdvisor) Check(ctx advisor.Context, _ string) ([]*storepb.title := string(ctx.Rule.Type)var adviceList []*storepb.Advice+ // Check if the ghost database exists first.+ if !advisor.DatabaseExists(ctx, ghostDatabaseName) {+ adviceList = append(adviceList, &storepb.Advice{+ Status: level,+ Title: title,+ Content: fmt.Sprintf("Needs database %q to save temporary data for online migration but it does not exist", ghostDatabaseName),+ Code: advisor.DatabaseNotExists.Int32(),+ StartPosition: &storepb.Position{+ Line: 0,+ },+ })+ return adviceList, nil+ }++ // Check statements.for _, stmt := range stmtList {checker := &useGhostChecker{currentDatabase: ctx.CurrentDatabase,diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vueindex 11be5e2baf..239d5acf08 100644--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue@@ -81,7 +81,7 @@ const errors = computed(() => {if (!database.backupAvailable) {errors.push(t(- "task.online-migration.error.not-applicable.needs-database-for-saving-temp-tables",+ "task.online-migration.error.not-applicable.needs-database-for-saving-temp-data",{// The same database name as backup.database: "bbdataarchive",diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 79848808f8..6ed9fd23ff 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -287,7 +287,7 @@"nothing-changed": "Nothing changed","not-applicable": {"task-doesnt-meet-ghost-requirement": "Task doesn't meet gh-ost's requirement",- "needs-database-for-saving-temp-tables": "Needs database({database}) for saving temporary tables."+ "needs-database-for-saving-temp-data": "Needs database {database} for saving temporary data."}},"advice-split-statement-to-single-online-migration-issue": "Advice splitting this statement to single online migration issue."diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 2fc459130a..9200b8fc85 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -287,7 +287,7 @@"nothing-changed": "nada ha cambiado","not-applicable": {"task-doesnt-meet-ghost-requirement": "La tarea no cumple con el requisito de gh-ost",- "needs-database-for-saving-temp-tables": "Necesita la base de datos ({database}) para guardar tablas temporales."+ "needs-database-for-saving-temp-data": "Necesita la base de datos ({database}) para guardar tablas temporales."}},"advice-split-statement-to-single-online-migration-issue": "Se recomienda dividir esta declaración en un único problema de migración en línea."diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 0b7ea9f32b..8488dd4151 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -287,7 +287,7 @@"nothing-changed": "変化なし","not-applicable": {"task-doesnt-meet-ghost-requirement": "タスクは gh-ost の要件を満たしていません",- "needs-database-for-saving-temp-tables": "一時テーブルを保存するにはデータベース({database})が必要です。"+ "needs-database-for-saving-temp-data": "一時データを保存するにはデータベース({database})が必要です。"}},"advice-split-statement-to-single-online-migration-issue": "このステートメントを 1 つのオンライン移行の問題に分割することをアドバイスします。"@@ -2718,4 +2718,4 @@"last-visit": "最終訪問","changelog-for-version": "{version} の変更履歴"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 58d6c1076e..c3c3641113 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -287,7 +287,7 @@"nothing-changed": "Không có gì thay đổi","not-applicable": {"task-doesnt-meet-ghost-requirement": "Nhiệm vụ không đáp ứng được yêu cầu của gh-ost",- "needs-database-for-saving-temp-tables": "Cần có cơ sở dữ liệu ({database}) để lưu các bảng tạm thời."+ "needs-database-for-saving-temp-data": "Cần có cơ sở dữ liệu ({database}) để lưu dữ liệu tạm thời."}},"advice-split-statement-to-single-online-migration-issue": "Đề nghị chia câu lệnh này thành một vấn đề di chuyển trực tuyến."@@ -2718,4 +2718,4 @@"last-visit": "Lần truy cập cuối","changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex adac64ff75..dd579c66a1 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -287,7 +287,7 @@"nothing-changed": "无任何改变","not-applicable": {"task-doesnt-meet-ghost-requirement": "任务不符合 gh-ost 的要求",- "needs-database-for-saving-temp-tables": "需要数据库({database})来保存临时表。"+ "needs-database-for-saving-temp-data": "需要数据库 {database} 来保存临时数据。"}},"advice-split-statement-to-single-online-migration-issue": "建议将该语句拆分成单独的在线大表变更工单。"@@ -2718,4 +2718,4 @@"last-visit": "上次访问","changelog-for-version": "{version} 的更新日志"}-}\ No newline at end of file+}