Skip to content

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

feat: disallow establish baseline to unassigned databases (#4700)

Liu Jie9a30909d68b
diff --git a/frontend/src/components/DatabaseMigrationHistoryPanel.vue b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
index 83a2e080e6..9a335904e9 100644
--- a/frontend/src/components/DatabaseMigrationHistoryPanel.vue
+++ b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
@@ -13,10 +13,10 @@
@click="state.showBaselineModal = true"
>
{{ $t("change-history.establish-baseline") }}
- <template v-if="isTenantProject" #tooltip>
- <div class="w-52 whitespace-pre-wrap">
+ <template v-if="database.project.id === DEFAULT_PROJECT_ID" #tooltip>
+ <div class="whitespace-pre-line">
{{
- $t("issue.not-allowed-to-single-database-in-tenant-mode", {
+ $t("issue.not-allowed-to-operate-unassigned-database", {
operation: $t(
"change-history.establish-baseline"
).toLowerCase(),
@@ -78,6 +78,7 @@ import { useI18n } from "vue-i18n";
import MigrationHistoryTable from "../components/MigrationHistoryTable.vue";
import {
Database,
+ DEFAULT_PROJECT_ID,
InstanceMigration,
MigrationHistory,
MigrationSchemaStatus,
@@ -163,6 +164,10 @@ export default defineComponent({
if (state.migrationSetupStatus !== "OK") return false;
+ if (props.database.project.id === DEFAULT_PROJECT_ID) {
+ return false;
+ }
+
// Migrating single database in tenant mode is not allowed
// Since this will probably cause different migration version across a group of tenant databases
return !isTenantProject.value;
@@ -233,6 +238,7 @@ export default defineComponent({
};
return {
+ DEFAULT_PROJECT_ID,
state,
allowConfigInstance,
isTenantProject,
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 53f02119df..29bb89c834 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -587,7 +587,7 @@
"stage-select": {
"active": "{name} (active)"
},
- "not-allowed-to-single-database-in-tenant-mode": "Can't {operation} to single database in tenant mode",
+ "not-allowed-to-operate-unassigned-database": "Can't {operation} to unassigned databases.\nIt need to be transferred to a project first.",
"migration-mode": {
"title": "Migration mode",
"normal": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 24ccde55e2..cca7b279ce 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -585,7 +585,7 @@
"stage-select": {
"active": "{name}(活动中)"
},
- "not-allowed-to-single-database-in-tenant-mode": "在多租户模式下无法对单个数据库{operation}",
+ "not-allowed-to-operate-unassigned-database": "未分配的数据库无法{operation}。\n需要先将它转移到项目里。",
"migration-mode": {
"title": "变更模式",
"normal": {