Skip to content

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

chore: show schema drifted warning before creating issue (#15906)

boojack53a524a3a504
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
index b2fc35d616..27c4bcc621 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
@@ -109,7 +109,7 @@ import {
ChevronsDownIcon,
SquareStackIcon,
} from "lucide-vue-next";
-import { NButton, NTooltip } from "naive-ui";
+import { NButton, NTooltip, useDialog } from "naive-ui";
import type { VNode } from "vue";
import { computed, h, reactive } from "vue";
import { useI18n } from "vue-i18n";
@@ -194,6 +194,7 @@ const dbSchemaStore = useDBSchemaV1Store();
const disableSchemaEditor = useAppFeature(
"bb.feature.issue.disable-schema-editor"
);
+const dialog = useDialog();
const selectedProjectNames = computed(() => {
return new Set(props.databases.map((db) => db.project));
@@ -294,12 +295,38 @@ const operations = computed(() => {
});
});
+const showDatabaseDriftedWarningDialog = () => {
+ return new Promise((resolve) => {
+ dialog.create({
+ type: "warning",
+ positiveText: t("common.confirm"),
+ negativeText: t("common.cancel"),
+ title: t("issue.schema-drift-detected.self"),
+ content: t("issue.schema-drift-detected.description"),
+ autoFocus: false,
+ onNegativeClick: () => {
+ resolve(false);
+ },
+ onPositiveClick: () => {
+ resolve(true);
+ },
+ });
+ });
+};
+
const generateMultiDb = async (
type:
| "bb.issue.database.schema.update"
| "bb.issue.database.data.update"
| "bb.issue.database.data.export"
) => {
+ // Check if any database is drifted.
+ if (props.databases.some((d) => d.drifted)) {
+ const confirmed = await showDatabaseDriftedWarningDialog();
+ if (!confirmed) {
+ return;
+ }
+ }
if (
props.databases.length === 1 &&
type === "bb.issue.database.schema.update" &&
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 1dbdd24537..85db81c48e 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -987,6 +987,10 @@
"create-database": "Create database",
"request-querier-role": "Request querier role",
"request-exporter-role": "Request exporter role"
+ },
+ "schema-drift-detected": {
+ "self": "Schema drift detected",
+ "description": "The selected database(s) has schema drift. Please make sure the drift is expected and safe to apply."
}
},
"quick-action": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 20cbc74b67..2aeb3076b5 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -987,6 +987,10 @@
"create-database": "Crear base de datos",
"request-querier-role": "Rol de consultador de solicitudes",
"request-exporter-role": "Solicitar función de exportación"
+ },
+ "schema-drift-detected": {
+ "self": "Se detectó una desviación del esquema",
+ "description": "Las bases de datos seleccionadas presentan una desviación de esquema. Asegúrese de que la desviación sea la esperada y de que sea segura para su aplicación."
}
},
"quick-action": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 85dd2c0193..9c8e0a8822 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -987,6 +987,10 @@
"create-database": "データベースを作成する",
"request-querier-role": "リクエストクエリーロール",
"request-exporter-role": "エクスポートロールのリクエスト"
+ },
+ "schema-drift-detected": {
+ "self": "スキーマドリフトが検出されました",
+ "description": "選択したデータベースにはスキーマドリフトがあります。ドリフトが想定どおりであり、適用しても安全であることを確認してください。"
}
},
"quick-action": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 2e22116bc2..8db2eddb7d 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -987,6 +987,10 @@
"create-database": "Tạo cơ sở dữ liệu",
"request-querier-role": "Yêu cầu vai trò người truy vấn",
"request-exporter-role": "Yêu cầu vai trò người xuất"
+ },
+ "schema-drift-detected": {
+ "self": "Đã phát hiện sự trôi dạt của sơ đồ",
+ "description": "Cơ sở dữ liệu được chọn có sự trôi dạt lược đồ. Vui lòng đảm bảo rằng sự trôi dạt này được mong đợi và an toàn để áp dụng."
}
},
"quick-action": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 76022a5511..ffbc8ffa90 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -987,6 +987,10 @@
"create-database": "创建数据库",
"request-querier-role": "申请查询者角色",
"request-exporter-role": "申请导出者角色"
+ },
+ "schema-drift-detected": {
+ "self": "检测到 Schema 偏差",
+ "description": "所选数据库存在 Schema 偏差,请在变更前确保该偏差符合预期。"
}
},
"quick-action": {