Skip to content

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

feat: improve schema sync wording (#4655)

Tianzhou (天舟)d272f76b4591
diff --git a/frontend/src/components/SyncDatabaseSchemaPrepForm.vue b/frontend/src/components/SyncDatabaseSchemaPrepForm.vue
index 26c5789ff9..2a1a98705b 100644
--- a/frontend/src/components/SyncDatabaseSchemaPrepForm.vue
+++ b/frontend/src/components/SyncDatabaseSchemaPrepForm.vue
@@ -20,7 +20,7 @@
<div class="w-full flex space-x-4">
<div class="flex w-48 items-center">
- {{ $t("database.sync-schema.select-database") }}
+ {{ $t("database.sync-schema.to-database") }}
</div>
<div
class="w-full flex flex-row justify-start items-center px-px relative"
@@ -146,13 +146,17 @@
</div>
<!-- Schema diff container -->
- <div class="w-full flex flex-col justify-start items-start">
+ <div class="pt-4 w-full flex flex-col justify-start items-start">
<div class="w-full flex flex-row justify-start items-center mb-2">
- <span>{{ $t("database.sync-schema.schema-diff") }}</span>
+ <span>{{ previewSchemaChangeMessage }}</span>
</div>
<div v-if="!shouldShowDiff" class="w-full border px-4 py-4">
- <p class="w-full text-left py-2">
- {{ $t("database.sync-schema.select-schema-and-target-database-tip") }}
+ <p class="w-full text-left text-warning py-2">
+ {{
+ isValidId(state.targetDatabaseInfo.databaseId)
+ ? $t("database.sync-schema.select-from-database-and-schema-tip")
+ : $t("database.sync-schema.select-to-database-tip")
+ }}
</p>
</div>
<template v-else>
@@ -163,7 +167,7 @@
"
class="w-full border px-4 py-4"
>
- <p class="w-full text-left py-2">
+ <p class="w-full text-left text-gray-500 py-2">
{{ $t("database.sync-schema.no-difference-tip") }}
</p>
</div>
@@ -254,6 +258,7 @@
<script lang="ts" setup>
import axios from "axios";
import dayjs from "dayjs";
+import { useI18n } from "vue-i18n";
import { head, isUndefined } from "lodash-es";
import { NEllipsis } from "naive-ui";
import { computed, reactive, ref, watch } from "vue";
@@ -310,6 +315,7 @@ const props = withDefaults(
}
);
const emit = defineEmits(["dismiss"]);
+const { t } = useI18n();
const router = useRouter();
@@ -412,6 +418,22 @@ const hasDiffBetweenCharactorSets = computed(() => {
);
});
+const previewSchemaChangeMessage = computed(() => {
+ if (
+ !isValidId(state.baseSchemaInfo.databaseId) ||
+ !isValidId(state.targetDatabaseInfo.databaseId)
+ ) {
+ return t("database.sync-schema.schema-change-preview-no-database");
+ }
+
+ const baseDatabase = databaseStore.getDatabaseById(
+ state.baseSchemaInfo.databaseId as number
+ );
+ return t("database.sync-schema.schema-change-preview", {
+ database: `${baseDatabase.name} (${baseDatabase.instance.environment.name} - ${baseDatabase.instance.name})`,
+ });
+});
+
const databaseMigrationHistoryList = (databaseId: DatabaseId) => {
const database = databaseStore.getDatabaseById(databaseId);
const list = instanceStore
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 69bd1ff4b0..78463fc49a 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -884,7 +884,7 @@
},
"change-history": {
"self": "Change History",
- "select": "Select version",
+ "select": "Schema version is recorded each time a schema change is applied via Bytebase",
"workflow": "Workflow",
"commit-info": "by {author} at {time}",
"no-schema-change": "this migration has no schema change",
@@ -1024,12 +1024,14 @@
"sync-schema": {
"title": "Synchronize Schema",
"select-project": "Select project",
- "select-database": "Apply to database",
+ "to-database": "Apply to database",
"from-database": "From database",
- "schema-diff": "The schema diff",
- "synchronize-statements": "The DDL statements",
- "synchronize-statements-description": "You can further edit the generated DDL statements.",
- "select-schema-and-target-database-tip": "Please select the schema and database first.",
+ "schema-change-preview": "Preview Schema change for '{database}'",
+ "schema-change-preview-no-database": "Preview Schema change",
+ "synchronize-statements": "Corresponding generated DDL statements",
+ "synchronize-statements-description": "You can further edit the generated DDL statements",
+ "select-from-database-and-schema-tip": "Select the database and schema version to be synced from",
+ "select-to-database-tip": "Select the database to be applied to",
"no-difference-tip": "No diff found.",
"more-version": "more...",
"character-sets-diff-found": "There are differences between character sets.",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 622068d352..b6f01272a3 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -884,7 +884,7 @@
},
"change-history": {
"self": "变更历史",
- "select": "选择版本",
+ "select": "Schema 版本是在每次通过 Bytebase 执行 Schema 变更后被记录下来的",
"workflow": "工作流",
"commit-info": "由 {author} 于 {time}",
"no-schema-change": "本次变更没有任何 Schema 的改动",
@@ -1024,13 +1024,15 @@
"sync-schema": {
"title": "库表同步",
"select-project": "选择项目",
- "select-database": "选择待同步的数据库",
+ "to-database": "选择待同步的数据库",
"from-database": "选择源数据库",
- "schema-diff": "Schema 对比结果",
- "synchronize-statements": "DDL 语句",
- "synchronize-statements-description": "您可以继续编辑生成的 Schema DDL 语句。",
- "select-schema-and-target-database-tip": "请先选择 Schema 和数据库。",
- "no-difference-tip": "没有发现差异。",
+ "schema-change-preview": "预览 '{database}' 的 Schema 变更",
+ "schema-change-preview-no-database": "预览 Schema 变更",
+ "synchronize-statements": "对应生成的 DDL 语句",
+ "synchronize-statements-description": "您可以继续编辑生成的 Schema DDL 语句",
+ "select-from-database-and-schema-tip": "选择源数据库和 Schema 版本",
+ "select-to-database-tip": "选择待同步的数据库",
+ "no-difference-tip": "没有发现差异",
"more-version": "更多...",
"character-sets-diff-found": "Schema 之间的字符集不同",
"preview-issue": "预览工单"