Skip to content

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

feat: make Schema Editor an optional helper instead of mandatory modal (#18021)

Danny Xua7dceb289abf
diff --git a/.gitignore b/.gitignore
index d70521935e..23c4cc3ae8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,9 @@ bytebase-build
# Claude Code configuration
.claude
+# Git worktrees
+.worktrees/
+
.DS_Store
# Azure Marketplace build artifacts
diff --git a/CLAUDE.md b/CLAUDE.md
index beb716122b..82cbb7180e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -121,6 +121,7 @@ psql -U bbdev bbdev
- Follow TypeScript style with strict type checking
- **i18n**: All user-facing display text in the UI must be defined and maintained in locale files under `./frontend/src/locales/` using the i18n internationalization system. Do not hardcode any display strings directly in the source code
+ - **No Empty Objects**: Do not add empty JSON objects (e.g., `"key": {}`) to locale files. Remove any empty objects you encounter
- **Button Spacing**: Use `gap-x-2` for ALL button groups (modals, drawers, toolbars, inline actions). Never use `space-x` for buttons. See `./frontend/.claude/BUTTON_SPACING_STANDARDIZATION.md` for full guidelines
### Naming
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
deleted file mode 100644
index 02157c1a29..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ /dev/null
@@ -1,531 +0,0 @@
-<template>
- <BBModal
- :title="$t('database.edit-schema')"
- :trap-focus="false"
- class="schema-editor-modal-container overflow-auto"
- style="
- width: calc(100vw - 40px);
- max-width: calc(100vw - 40px);
- height: calc(100vh - 40px);
- max-height: calc(100vh - 40px);
- "
- container-class="h-full flex flex-col gap-y-4"
- @close="dismissModal"
- >
- <MaskSpinner v-if="state.previewStatus" class="bg-white/75!">
- <span class="text-sm">
- {{ state.previewStatus }}
- </span>
- </MaskSpinner>
-
- <NTabs
- v-model:value="state.selectedTab"
- size="small"
- type="card"
- class="flex-1"
- >
- <NTabPane
- class="flex-1"
- name="schema-editor"
- :tab="$t('schema-editor.self')"
- display-directive="show:lazy"
- >
- <SchemaEditorLite
- ref="schemaEditorRef"
- :project="project"
- :targets="state.targets"
- :loading="state.isPreparingMetadata"
- />
- </NTabPane>
- <NTabPane
- class="flex-1"
- name="raw-sql"
- :tab="$t('schema-editor.raw-sql')"
- display-directive="show:lazy"
- >
- <div class="w-full h-full grid grid-rows-[50px_1fr] overflow-y-auto">
- <div
- class="w-full h-full shrink-0 flex flex-row justify-between items-center"
- >
- <div>{{ $t("sql-editor.self") }}</div>
- <div class="flex flex-row justify-end items-center gap-x-2">
- <SQLUploadButton
- :loading="state.isUploadingFile"
- @update:sql="(statement) => (state.editStatement = statement)"
- >
- {{ $t("issue.upload-sql") }}
- </SQLUploadButton>
- <NButton @click="handleSyncSQLFromSchemaEditor">
- <template #icon>
- <heroicons-outline:arrow-path
- class="w-4 h-auto text-gray-500"
- />
- </template>
- {{ $t("schema-editor.sync-sql-from-schema-editor") }}
- </NButton>
- </div>
- </div>
- <MonacoEditor
- v-model:content="state.editStatement"
- class="border w-[calc(100%-2px)] h-[calc(100%-2px)]"
- data-label="bb-schema-editor-sql-editor"
- :auto-focus="false"
- :dialect="dialectOfEngineV1(databaseEngine)"
- />
- </div>
- </NTabPane>
- <template #suffix>
- <SchemaEditorSQLCheckButton
- v-if="!state.isPreparingMetadata"
- :database-list="databaseList"
- :get-statement="generateOrGetEditingDDL"
- />
- </template>
- </NTabs>
-
- <div class="w-full flex flex-row justify-between items-center">
- <div class="flex flex-row items-center text-sm text-gray-500"></div>
- <div class="flex justify-end items-center gap-x-2">
- <NButton @click="dismissModal">
- {{ $t("common.cancel") }}
- </NButton>
- <NButton
- type="primary"
- :disabled="!allowPreviewIssue"
- @click="handlePreviewIssue"
- >
- {{ $t("schema-editor.preview-issue") }}
- </NButton>
- </div>
- </div>
- </BBModal>
-
- <!-- Close modal confirm dialog -->
- <ActionConfirmModal
- v-model:show="state.showActionConfirmModal"
- :title="$t('schema-editor.confirm-to-close.title')"
- :description="$t('schema-editor.confirm-to-close.description')"
- @confirm="emit('close')"
- />
-</template>
-
-<script lang="tsx" setup>
-import { cloneDeep, head, uniq } from "lodash-es";
-import { NTabs, NButton, NTabPane, useDialog } from "naive-ui";
-import { v4 as uuidv4 } from "uuid";
-import { computed, onMounted, h, reactive, ref, watch, watchEffect } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter, type LocationQuery } from "vue-router";
-import { BBModal } from "@/bbkit";
-import { ActionConfirmModal } from "@/components/SchemaEditorLite";
-import SQLUploadButton from "@/components/misc/SQLUploadButton.vue";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import {
- pushNotification,
- useDatabaseV1Store,
- useNotificationStore,
- useDBSchemaV1Store,
- useStorageStore,
- useDatabaseCatalogV1Store,
- batchGetOrFetchDatabases,
-} from "@/store";
-import type { ComposedDatabase } from "@/types";
-import { unknownProject, isValidProjectName, dialectOfEngineV1 } from "@/types";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import {
- TinyTimer,
- defer,
- extractProjectResourceName,
- generateIssueTitle,
-} from "@/utils";
-import { MonacoEditor } from "../MonacoEditor";
-import { provideSQLCheckContext } from "../SQLCheck";
-import type { EditTarget, GenerateDiffDDLResult } from "../SchemaEditorLite";
-import SchemaEditorLite, {
- generateDiffDDL as generateSingleDiffDDL,
-} from "../SchemaEditorLite";
-import MaskSpinner from "../misc/MaskSpinner.vue";
-import SchemaEditorSQLCheckButton from "./SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue";
-
-type TabType = "raw-sql" | "schema-editor";
-
-interface LocalState {
- selectedTab: TabType;
- editStatement: string;
- showActionConfirmModal: boolean;
- isPreparingMetadata: boolean;
- previewStatus: string;
- targets: EditTarget[];
- isUploadingFile: boolean;
-}
-
-const props = defineProps<{
- databaseNames: string[];
- alterType: "MULTI_DB" | "SINGLE_DB";
- newWindow?: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "close"): void;
-}>();
-
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-const { t } = useI18n();
-const router = useRouter();
-const state = reactive<LocalState>({
- selectedTab: "schema-editor",
- editStatement: "",
- showActionConfirmModal: false,
- isPreparingMetadata: true,
- previewStatus: "",
- targets: [],
- isUploadingFile: false,
-});
-const databaseV1Store = useDatabaseV1Store();
-const dbCatalogStore = useDatabaseCatalogV1Store();
-const notificationStore = useNotificationStore();
-const dbSchemaStore = useDBSchemaV1Store();
-const { runSQLCheck } = provideSQLCheckContext();
-const $dialog = useDialog();
-
-const allowPreviewIssue = computed(() => {
- if (state.selectedTab === "schema-editor") {
- // Always return true for schema editor to prevent huge calculation from schema editor.
- return schemaEditorRef.value?.isDirty ?? false;
- } else {
- return state.editStatement !== "";
- }
-});
-
-watchEffect(async () => {
- await batchGetOrFetchDatabases(props.databaseNames);
-});
-
-const databaseList = computed(() => {
- return props.databaseNames.map((database) => {
- return databaseV1Store.getDatabaseByName(database);
- });
-});
-
-// Returns the type if it's uniq.
-// Returns Engine.ENGINE_UNSPECIFIED if there are more than ONE types.
-const databaseEngine = computed((): Engine => {
- const engineTypes = uniq(
- databaseList.value.map((db) => db.instanceResource.engine)
- );
- if (engineTypes.length !== 1) return Engine.ENGINE_UNSPECIFIED;
- return engineTypes[0];
-});
-
-const project = computed(
- () => head(databaseList.value)?.projectEntity ?? unknownProject()
-);
-const editTargetsKey = computed(() => {
- return JSON.stringify({
- databaseNameList: props.databaseNames,
- alterType: props.alterType,
- });
-});
-
-const prepareDatabaseMetadata = async () => {
- state.isPreparingMetadata = true;
- state.targets = [];
- const timer = new TinyTimer<"fetchMetadata">("SchemaEditorModal");
- timer.begin("fetchMetadata");
- for (let i = 0; i < databaseList.value.length; i++) {
- const database = databaseList.value[i];
- const [metadata, catalog] = await Promise.all([
- // Fetch the latest metadata and catalog without cache.
- // So that we don't need to deep clone these objects.
- dbSchemaStore.getOrFetchDatabaseMetadata({
- database: database.name,
- skipCache: true,
- limit: 200,
- }),
- dbCatalogStore.getOrFetchDatabaseCatalog({
- database: database.name,
- skipCache: true,
- }),
- ]);
-
- state.targets.push({
- database,
- metadata: cloneDeep(metadata),
- baselineMetadata: metadata,
- catalog: cloneDeep(catalog),
- baselineCatalog: catalog,
- });
- }
- timer.end("fetchMetadata", databaseList.value.length);
- timer.printAll();
- state.isPreparingMetadata = false;
-};
-
-watch(editTargetsKey, prepareDatabaseMetadata, {
- immediate: true,
-});
-
-onMounted(async () => {
- if (
- databaseList.value.length === 0 ||
- !isValidProjectName(project.value.name)
- ) {
- notificationStore.pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Invalid database list",
- });
- emit("close");
- return;
- }
-});
-
-const dismissModal = () => {
- if (allowPreviewIssue.value) {
- state.showActionConfirmModal = true;
- } else {
- emit("close");
- }
-};
-
-const handleSyncSQLFromSchemaEditor = async () => {
- const statementMap = await generateDiffDDLMap(/* !silent */ false);
- const results = Array.from(statementMap.values());
-
- state.editStatement = results.map((result) => result.statement).join("\n\n");
-
- const emptyStatementDatabaseList: ComposedDatabase[] = [];
- for (const [database, result] of statementMap.entries()) {
- if (!result.statement) {
- emptyStatementDatabaseList.push(
- databaseV1Store.getDatabaseByName(database)
- );
- }
- }
- if (emptyStatementDatabaseList.length > 0) {
- // Some of the DDLs are empty
- warnEmptyGeneratedDDL(emptyStatementDatabaseList);
- }
-};
-
-const generateOrGetEditingDDL = async () => {
- if (state.selectedTab === "raw-sql") {
- return {
- statement: state.editStatement,
- errors: [],
- };
- }
- if (!schemaEditorRef.value?.isDirty) {
- // No change in schema editor, return empty statement directly.
- return {
- statement: "",
- errors: [],
- };
- }
-
- const statementMap = await generateDiffDDLMap(/* silent */ true);
- const results = Array.from(statementMap.values());
- const statement = results.map((result) => result.statement).join("\n\n");
- const errors = results.flatMap((result) => result.errors);
- return {
- statement,
- errors,
- };
-};
-
-const generateDiffDDLMap = async (silent: boolean) => {
- if (!silent) {
- state.previewStatus = "Generating DDL";
- }
-
- const statementMap = new Map<string, GenerateDiffDDLResult>();
-
- const applyMetadataEdit = schemaEditorRef.value?.applyMetadataEdit;
- if (typeof applyMetadataEdit !== "function") {
- throw new Error("SchemaEditor is not accessible");
- }
- for (let i = 0; i < state.targets.length; i++) {
- const target = state.targets[i];
- const { database, baselineMetadata, baselineCatalog } = target;
- const { metadata, catalog } = applyMetadataEdit(
- database,
- target.metadata,
- target.catalog
- );
-
- const result = await generateSingleDiffDDL({
- database,
- sourceMetadata: baselineMetadata,
- targetMetadata: metadata,
- sourceCatalog: baselineCatalog,
- targetCatalog: catalog,
- allowEmptyDiffDDLWithConfigChange: false,
- });
-
- if (result.errors.length > 0 && !silent) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: result.errors.join("\n"),
- });
- }
-
- statementMap.set(database.name, result);
- }
-
- state.previewStatus = "";
- return statementMap;
-};
-
-const handlePreviewIssue = async () => {
- if (state.previewStatus) {
- return;
- }
-
- const cleanup = async () => {
- state.previewStatus = "";
- };
-
- const check = runSQLCheck.value;
- if (check) {
- state.previewStatus = "Checking SQL";
- if (!(await check())) {
- return cleanup();
- }
- // TODO: optimize: check() could return the generated DDL to avoid
- // generating one more time below. useful for large schemas
- }
-
- const query: LocationQuery = {
- template: "bb.issue.database.schema.update",
- };
- query.databaseList = databaseList.value.map((db) => db.name).join(",");
-
- if (state.selectedTab === "raw-sql") {
- query.name = generateIssueTitle(
- "bb.issue.database.schema.update",
- databaseList.value.map((db) => db.databaseName)
- );
-
- const sqlStorageKey = `bb.issues.sql.${uuidv4()}`;
- useStorageStore().put(sqlStorageKey, state.editStatement);
- query.sqlStorageKey = sqlStorageKey;
- } else {
- query.name = generateIssueTitle(
- "bb.issue.database.schema.update",
- databaseList.value.map((db) => db.databaseName)
- );
-
- state.previewStatus = "Generating DDL";
- const statementMap = await generateDiffDDLMap(/* !silent */ false);
- const statementList: string[] = [];
- const emptyStatementDatabaseList: ComposedDatabase[] = [];
- for (const [database, result] of statementMap.entries()) {
- if (!result.statement) {
- emptyStatementDatabaseList.push(
- databaseV1Store.getDatabaseByName(database)
- );
- }
- statementList.push(result.statement);
- }
- if (emptyStatementDatabaseList.length > 0) {
- // Some of the DDLs are empty
- if (
- !(await confirmCreateIssueWithEmptyStatement(
- emptyStatementDatabaseList
- ))
- ) {
- return cleanup();
- }
- }
-
- query.databaseList = databaseList.value.map((db) => db.name).join(",");
-
- const sqlMap: Record<string, string> = {};
- databaseList.value.forEach((db, i) => {
- const sql = statementList[i];
- sqlMap[db.name] = sql;
- });
- const sqlMapStorageKey = `bb.issues.sql-map.${uuidv4()}`;
- useStorageStore().put(sqlMapStorageKey, sqlMap);
- query.sqlMapStorageKey = sqlMapStorageKey;
- const databaseNameList = databaseList.value.map((db) => db.databaseName);
- query.name = generateIssueTitle(
- "bb.issue.database.schema.update",
- databaseNameList
- );
- }
-
- const routeInfo = {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- issueSlug: "create",
- planId: "create",
- specId: "placeholder", // This will be replaced with the actual spec ID later.
- },
- query,
- };
- if (props.newWindow) {
- const route = router.resolve(routeInfo);
- window.open(route.fullPath, "__blank");
- } else {
- router.push(routeInfo);
- }
- cleanup();
-};
-
-const renderEmptyGeneratedDDLContent = (databases: ComposedDatabase[]) => {
- const children = databases.map((database) => {
- return (
- <li>
- {t("schema-editor.failed-to-generate-ddl-for-database", {
- database: database.databaseName,
- })}
- </li>
- );
- });
- return h(
- "ul",
- {
- class: "text-sm flex flex-col gap-y-1 max-h-80 overflow-y-auto",
- },
- children
- );
-};
-
-const warnEmptyGeneratedDDL = (databases: ComposedDatabase[]) => {
- pushNotification({
- module: "bytebase",
- style: "WARN",
- title: t("common.warning"),
- description: () => renderEmptyGeneratedDDLContent(databases),
- });
-};
-
-const confirmCreateIssueWithEmptyStatement = (
- databases: ComposedDatabase[]
-) => {
- const d = defer<boolean>();
- $dialog.warning({
- title: t("common.warning"),
- content: () => renderEmptyGeneratedDDLContent(databases),
- style: "z-index: 100000",
- negativeText: t("common.cancel"),
- positiveText: t("schema-editor.continue-with-empty-sql"),
- closeOnEsc: false,
- maskClosable: false,
- onClose: () => {
- d.resolve(false);
- },
- onNegativeClick: () => {
- d.resolve(false);
- },
- onPositiveClick: () => {
- d.resolve(true);
- },
- });
- return d.promise;
-};
-</script>
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
deleted file mode 100644
index a33ad760f1..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
+++ /dev/null
@@ -1,33 +0,0 @@
-<template>
- <SQLCheckButton
- v-if="show"
- :database="database"
- :get-statement="getStatement"
- :migration-type="Release_File_MigrationType.DDL"
- :button-props="{
- size: 'small',
- }"
- :show-code-location="false"
- :advice-filter="(advice) => advice.title !== 'advice.online-migration'"
- class="justify-end"
- />
-</template>
-<script lang="ts" setup>
-import { toRef } from "vue";
-import { SQLCheckButton } from "@/components/SQLCheck";
-import type { ComposedDatabase } from "@/types";
-import { Release_File_MigrationType } from "@/types/proto-es/v1/release_service_pb";
-import { useSchemaEditorSQLCheck } from "./useSchemaEditorSQLCheck";
-
-const props = defineProps<{
- databaseList: ComposedDatabase[];
- getStatement: () => Promise<{
- statement: string;
- errors: string[];
- }>;
-}>();
-
-const { show, database } = useSchemaEditorSQLCheck({
- databaseList: toRef(props, "databaseList"),
-});
-</script>
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/index.ts b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/index.ts
deleted file mode 100644
index e33d3e7bb4..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import SchemaEditorSQLCheckButton from "./SchemaEditorSQLCheckButton.vue";
-
-export default SchemaEditorSQLCheckButton;
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/useSchemaEditorSQLCheck.ts b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/useSchemaEditorSQLCheck.ts
deleted file mode 100644
index 9a568d761c..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/useSchemaEditorSQLCheck.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import type { Ref } from "vue";
-import { computed } from "vue";
-import type { ComposedDatabase } from "@/types";
-
-export const useSchemaEditorSQLCheck = (params: {
- databaseList: Ref<ComposedDatabase[]>;
-}) => {
- const { databaseList } = params;
-
- const show = computed(() => {
- // SQL Check is highly related to the databases' environments.
- // By now we cannot handle mixed environments correctly.
- // so we just support SQL Check when editing single database's schema.
- return databaseList.value.length === 1;
- });
-
- const database = computed(() => {
- return databaseList.value[0];
- });
-
- return { show, database };
-};
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemalessDatabaseTable.vue b/frontend/src/components/AlterSchemaPrepForm/SchemalessDatabaseTable.vue
deleted file mode 100644
index 1050252774..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SchemalessDatabaseTable.vue
+++ /dev/null
@@ -1,30 +0,0 @@
-<template>
- <div v-if="databaseList.length > 0" class="mt-4">
- <div class="px-0.5 mb-2">
- <NCheckbox v-model:checked="expand">
- {{ $t("database.show-schemaless-databases") }}
- </NCheckbox>
- </div>
- <DatabaseV1Table
- v-if="expand"
- :mode="`${mode}_SHORT`"
- :schemaless="true"
- :database-list="databaseList"
- :show-selection="false"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { NCheckbox } from "naive-ui";
-import { ref } from "vue";
-import { DatabaseV1Table } from "@/components/v2/Model/DatabaseV1Table";
-import type { ComposedDatabase } from "@/types";
-
-defineProps<{
- databaseList: ComposedDatabase[];
- mode: "PROJECT" | "ALL";
-}>();
-
-const expand = ref(false);
-</script>
diff --git a/frontend/src/components/Plan/components/AddSpecDrawer.vue b/frontend/src/components/Plan/components/AddSpecDrawer.vue
index 63078799f0..46f35b5331 100644
--- a/frontend/src/components/Plan/components/AddSpecDrawer.vue
+++ b/frontend/src/components/Plan/components/AddSpecDrawer.vue
@@ -15,10 +15,6 @@
<NSteps :current="currentStep">
<NStep :title="changeTypeTitle" />
<NStep :title="$t('plan.select-targets')" />
- <NStep
- v-if="shouldShowSchemaEditor"
- :title="$t('schema-editor.self')"
- />
</NSteps>
<!-- Step content -->
@@ -93,43 +89,11 @@
/>
</div>
</template>
-
- <!-- Step 3: Schema Editor (only for MIGRATE with single database) -->
- <template
- v-else-if="
- currentStep === Step.SCHEMA_EDITOR && shouldShowSchemaEditor
- "
- >
- <div
- class="relative h-[600px] w-full md:w-[90vw] lg:w-[calc(100vw-20rem)] lg:min-w-[80vw]"
- >
- <MaskSpinner v-if="isPreparingMetadata" />
- <SchemaEditorLite
- v-if="schemaEditTargets.length > 0"
- ref="schemaEditorRef"
- :project="project"
- :targets="schemaEditTargets"
- :loading="isPreparingMetadata"
- :hide-preview="false"
- />
- </div>
- </template>
</div>
</div>
<template #footer>
- <div class="w-full flex items-center justify-between">
- <div>
- <NButton
- v-if="
- currentStep === Step.SCHEMA_EDITOR && shouldShowSchemaEditor
- "
- :loading="isGeneratingPreview"
- @click="handlePreviewDDL"
- >
- {{ $t("schema-editor.preview-schema-text") }}
- </NButton>
- </div>
- <div class="flex items-center gap-x-3">
+ <div class="w-full flex items-center justify-end">
+ <div class="flex items-center gap-x-2">
<NButton
quaternary
v-if="currentStep === Step.SELECT_CHANGE_TYPE"
@@ -166,72 +130,22 @@
</template>
</DrawerContent>
</Drawer>
-
- <!-- Preview DDL Modal -->
- <NModal
- v-model:show="showPreviewModal"
- :mask-closable="true"
- :closable="true"
- style="width: 80vw; max-width: 1200px"
- >
- <NCard
- :title="$t('schema-editor.preview-schema-text')"
- :bordered="false"
- size="small"
- role="dialog"
- aria-modal="true"
- class="max-h-[80vh] overflow-hidden"
- >
- <template #header-extra>
- <NButton @click="showPreviewModal = false" :size="'small'"
- ><XIcon :size="16"
- /></NButton>
- </template>
- <div class="h-[60vh] min-h-[400px] border rounded-sm">
- <MonacoEditor
- :readonly="true"
- :content="previewDDL"
- :auto-focus="false"
- class="w-full h-full"
- language="sql"
- />
- </div>
- </NCard>
- </NModal>
</template>
<script setup lang="ts">
import { create as createProto } from "@bufbuild/protobuf";
-import { cloneDeep } from "lodash-es";
-import { FileDiffIcon, EditIcon, XIcon } from "lucide-vue-next";
-import {
- NButton,
- NRadio,
- NRadioGroup,
- NSteps,
- NStep,
- NModal,
- NCard,
-} from "naive-ui";
+import { FileDiffIcon, EditIcon } from "lucide-vue-next";
+import { NButton, NRadio, NRadioGroup, NSteps, NStep } from "naive-ui";
import { v4 as uuidv4 } from "uuid";
import type { Ref } from "vue";
import { computed, reactive, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import DatabaseAndGroupSelector from "@/components/DatabaseAndGroupSelector";
import type { DatabaseSelectState } from "@/components/DatabaseAndGroupSelector";
-import { MonacoEditor } from "@/components/MonacoEditor";
import { getLocalSheetByName, getNextLocalSheetUID } from "@/components/Plan";
-import SchemaEditorLite, {
- generateDiffDDL,
- type EditTarget,
-} from "@/components/SchemaEditorLite";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import {
useCurrentProjectV1,
- useDatabaseV1Store,
- useDBSchemaV1Store,
- useDatabaseCatalogV1Store,
batchGetOrFetchDatabases,
pushNotification,
} from "@/store";
@@ -244,8 +158,6 @@ import {
Plan_SpecSchema,
type Plan_Spec,
} from "@/types/proto-es/v1/plan_service_pb";
-import { setSheetStatement } from "@/utils";
-import { engineSupportsSchemaEditor } from "@/utils/schemaEditor";
defineProps<{
title?: string;
@@ -258,25 +170,15 @@ const emit = defineEmits<{
enum Step {
SELECT_CHANGE_TYPE = 1,
SELECT_TARGETS = 2,
- SCHEMA_EDITOR = 3,
}
const { project } = useCurrentProjectV1();
const { t } = useI18n();
const show = defineModel<boolean>("show", { default: false });
-const databaseV1Store = useDatabaseV1Store();
-const dbSchemaStore = useDBSchemaV1Store();
-const dbCatalogStore = useDatabaseCatalogV1Store();
const selectedMigrationType: Ref<MigrationType> = ref(MigrationType.DDL);
const isCreating = ref(false);
const currentStep = ref(Step.SELECT_CHANGE_TYPE);
-const isPreparingMetadata = ref(false);
-const schemaEditTargets = ref<EditTarget[]>([]);
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-const showPreviewModal = ref(false);
-const previewDDL = ref("");
-const isGeneratingPreview = ref(false);
const databaseSelectState = reactive<DatabaseSelectState>({
changeSource: "DATABASE",
@@ -305,27 +207,8 @@ const canProceedToNextStep = computed(() => {
return false;
});
-const shouldShowSchemaEditor = computed(() => {
- if (!isMigrateSelected.value) return false;
- if (databaseSelectState.changeSource !== "DATABASE") return false;
- if (databaseSelectState.selectedDatabaseNameList.length !== 1) return false;
-
- // Check if the selected database engine supports schema editor
- const databaseName = databaseSelectState.selectedDatabaseNameList[0];
- if (!databaseName) return false;
-
- const database = databaseV1Store.getDatabaseByName(databaseName);
- if (!database || !database.instanceResource) return false;
-
- return engineSupportsSchemaEditor(database.instanceResource.engine);
-});
-
-const totalSteps = computed(() => {
- return shouldShowSchemaEditor.value ? 3 : 2;
-});
-
const isLastStep = computed(() => {
- return currentStep.value === totalSteps.value;
+ return currentStep.value === Step.SELECT_TARGETS;
});
const changeTypeTitle = computed(() => {
@@ -356,11 +239,6 @@ watch(show, (newVal) => {
databaseSelectState.selectedDatabaseNameList = [];
databaseSelectState.selectedDatabaseGroup = undefined;
isCreating.value = false;
- isPreparingMetadata.value = false;
- schemaEditTargets.value = [];
- showPreviewModal.value = false;
- previewDDL.value = "";
- isGeneratingPreview.value = false;
}
});
@@ -380,115 +258,18 @@ const handleCancel = () => {
show.value = false;
};
-const prepareDatabaseMetadata = async () => {
- if (!shouldShowSchemaEditor.value) return;
-
- isPreparingMetadata.value = true;
- schemaEditTargets.value = [];
-
- try {
- const databaseName = databaseSelectState.selectedDatabaseNameList[0];
- await batchGetOrFetchDatabases([databaseName]);
-
- const database = databaseV1Store.getDatabaseByName(databaseName);
-
- const [metadata, catalog] = await Promise.all([
- dbSchemaStore.getOrFetchDatabaseMetadata({
- database: database.name,
- skipCache: true,
- limit: 500,
- }),
- dbCatalogStore.getOrFetchDatabaseCatalog({
- database: database.name,
- skipCache: true,
- }),
- ]);
-
- schemaEditTargets.value = [
- {
- database,
- metadata: cloneDeep(metadata),
- baselineMetadata: metadata,
- catalog: cloneDeep(catalog),
- baselineCatalog: catalog,
- },
- ];
- } finally {
- isPreparingMetadata.value = false;
- }
-};
-
const handleNextStep = async () => {
if (
currentStep.value === Step.SELECT_CHANGE_TYPE &&
selectedMigrationType.value
) {
currentStep.value = Step.SELECT_TARGETS;
- } else if (currentStep.value === Step.SELECT_TARGETS && hasSelection.value) {
- if (shouldShowSchemaEditor.value) {
- currentStep.value = Step.SCHEMA_EDITOR;
- await prepareDatabaseMetadata();
- } else {
- await handleConfirm();
- }
}
};
const handlePrevStep = () => {
if (currentStep.value === Step.SELECT_TARGETS) {
currentStep.value = Step.SELECT_CHANGE_TYPE;
- } else if (currentStep.value === Step.SCHEMA_EDITOR) {
- currentStep.value = Step.SELECT_TARGETS;
- }
-};
-
-const handlePreviewDDL = async () => {
- if (!shouldShowSchemaEditor.value || schemaEditTargets.value.length === 0)
- return;
-
- isGeneratingPreview.value = true;
- try {
- const target = schemaEditTargets.value[0];
- const applyMetadataEdit = schemaEditorRef.value?.applyMetadataEdit;
- const refreshPreview = schemaEditorRef.value?.refreshPreview;
-
- if (typeof applyMetadataEdit === "function") {
- const { database, baselineMetadata, baselineCatalog } = target;
- const { metadata, catalog } = applyMetadataEdit(
- database,
- target.metadata,
- target.catalog
- );
-
- // Trigger preview refresh in the schema editor
- if (typeof refreshPreview === "function") {
- refreshPreview();
- }
-
- const result = await generateDiffDDL({
- database,
- sourceMetadata: baselineMetadata,
- targetMetadata: metadata,
- sourceCatalog: baselineCatalog,
- targetCatalog: catalog,
- allowEmptyDiffDDLWithConfigChange: false,
- });
-
- if (result.errors.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: result.errors.join("\n"),
- });
- return;
- }
-
- previewDDL.value = result.statement || "-- No changes detected";
- showPreviewModal.value = true;
- }
- } finally {
- isGeneratingPreview.value = false;
}
};
@@ -505,53 +286,6 @@ const handleConfirm = async () => {
targets.push(databaseSelectState.selectedDatabaseGroup);
}
- let statement = "";
-
- // Generate diff DDL if we're on step 3 (schema editor)
- if (
- currentStep.value === Step.SCHEMA_EDITOR &&
- shouldShowSchemaEditor.value &&
- schemaEditTargets.value.length > 0
- ) {
- const target = schemaEditTargets.value[0];
- const applyMetadataEdit = schemaEditorRef.value?.applyMetadataEdit;
- const refreshPreview = schemaEditorRef.value?.refreshPreview;
-
- if (typeof applyMetadataEdit === "function") {
- const { database, baselineMetadata, baselineCatalog } = target;
- const { metadata, catalog } = applyMetadataEdit(
- database,
- target.metadata,
- target.catalog
- );
- // Trigger preview refresh before generating final DDL
- if (typeof refreshPreview === "function") {
- refreshPreview();
- }
-
- const result = await generateDiffDDL({
- database,
- sourceMetadata: baselineMetadata,
- targetMetadata: metadata,
- sourceCatalog: baselineCatalog,
- targetCatalog: catalog,
- allowEmptyDiffDDLWithConfigChange: false,
- });
-
- if (result.errors.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: result.errors.join("\n"),
- });
- return;
- }
-
- statement = result.statement;
- }
- }
-
const sheetUID = getNextLocalSheetUID();
const localSheet = getLocalSheetByName(
`${project.value.name}/sheets/${sheetUID}`
@@ -560,9 +294,6 @@ const handleConfirm = async () => {
selectedMigrationType.value === MigrationType.DDL
? "Schema Migration"
: "Data Change";
- if (statement) {
- setSheetStatement(localSheet, statement);
- }
// Create spec
const spec = createProto(Plan_SpecSchema, {
diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
index 4cb25fd053..864bd3031b 100644
--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
@@ -21,6 +21,16 @@
>
{{ $t("issue.upload-sql") }}
</SQLUploadButton>
+ <NButton
+ v-if="shouldShowSchemaEditorButton"
+ size="small"
+ @click="handleOpenSchemaEditor"
+ >
+ <template #icon>
+ <TableIcon />
+ </template>
+ {{ $t("schema-editor.self") }}
+ </NButton>
</template>
<template v-else>
@@ -62,6 +72,16 @@
>
{{ $t("issue.upload-sql") }}
</SQLUploadButton>
+ <NButton
+ v-if="shouldShowSchemaEditorButton"
+ size="small"
+ @click="handleOpenSchemaEditor"
+ >
+ <template #icon>
+ <TableIcon />
+ </template>
+ {{ $t("schema-editor.self") }}
+ </NButton>
<NButton
v-if="editorState.isEditing.value"
size="small"
@@ -160,12 +180,20 @@
/>
</div>
</BBModal>
+
+ <SchemaEditorDrawer
+ v-if="shouldShowSchemaEditorButton"
+ v-model:show="state.showSchemaEditorDrawer"
+ :databases="targetDatabases"
+ :project="project"
+ @insert="handleInsertSQL"
+ />
</template>
<script setup lang="ts">
import { create } from "@bufbuild/protobuf";
import { cloneDeep, includes, isEmpty } from "lodash-es";
-import { ExpandIcon } from "lucide-vue-next";
+import { ExpandIcon, TableIcon } from "lucide-vue-next";
import { NButton, NTooltip, useDialog } from "naive-ui";
import { v1 as uuidv1 } from "uuid";
import { computed, reactive, watch } from "vue";
@@ -189,10 +217,12 @@ import { planServiceClientConnect } from "@/grpcweb";
import {
pushNotification,
useCurrentProjectV1,
+ useDatabaseV1Store,
useSheetV1Store,
} from "@/store";
import type { SQLDialect } from "@/types";
import { dialectOfEngineV1 } from "@/types";
+import { MigrationType } from "@/types/proto-es/v1/common_pb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";
@@ -202,7 +232,9 @@ import {
setSheetStatement,
useInstanceV1EditorLanguage,
} from "@/utils";
+import { engineSupportsSchemaEditor } from "@/utils/schemaEditor";
import { useSelectedSpec } from "../../SpecDetailView/context";
+import SchemaEditorDrawer from "../SchemaEditorDrawer.vue";
import { useSQLAdviceMarkers } from "../useSQLAdviceMarkers";
import { useSpecSheet } from "../useSpecSheet";
@@ -210,6 +242,7 @@ type LocalState = {
statement: string;
showEditorModal: boolean;
isUploadingFile: boolean;
+ showSchemaEditorDrawer: boolean;
};
const { t } = useI18n();
@@ -224,6 +257,7 @@ const state = reactive<LocalState>({
statement: "",
showEditorModal: false,
isUploadingFile: false,
+ showSchemaEditorDrawer: false,
});
const database = computed(() => {
@@ -347,6 +381,53 @@ const allowSaveSQL = computed((): boolean => {
return true;
});
+const shouldShowSchemaEditorButton = computed(() => {
+ const spec = selectedSpec.value;
+
+ // Check config exists and is the right type
+ if (!spec?.config || spec.config.case !== "changeDatabaseConfig") {
+ return false;
+ }
+
+ // Now TypeScript knows config.value is Plan_ChangeDatabaseConfig
+ // Only for DDL (schema) changes
+ if (spec.config.value.migrationType !== MigrationType.DDL) {
+ return false;
+ }
+
+ // Only if at least one database engine supports schema editor
+ const targets = spec.config.value.targets || [];
+ if (targets.length === 0) {
+ return false;
+ }
+
+ // Check if at least one target database supports schema editor
+ const databaseStore = useDatabaseV1Store();
+ const hasSupported = targets.some((targetName) => {
+ const db = databaseStore.getDatabaseByName(targetName);
+ return engineSupportsSchemaEditor(db.instanceResource.engine);
+ });
+
+ if (!hasSupported) {
+ return false;
+ }
+
+ return true;
+});
+
+const targetDatabases = computed(() => {
+ const spec = selectedSpec.value;
+ if (!spec?.config || spec.config.case !== "changeDatabaseConfig") {
+ return [];
+ }
+
+ const databaseStore = useDatabaseV1Store();
+ const targets = spec.config.value.targets || [];
+ return targets
+ .map((targetName) => databaseStore.getDatabaseByName(targetName))
+ .filter((db) => engineSupportsSchemaEditor(db.instanceResource.engine));
+});
+
const beginEdit = () => {
editorState.setEditingState(true);
};
@@ -364,6 +445,18 @@ const cancelEdit = () => {
editorState.setEditingState(false);
};
+const handleOpenSchemaEditor = () => {
+ state.showSchemaEditorDrawer = true;
+};
+
+const handleInsertSQL = (sql: string) => {
+ // Append generated SQL to existing content
+ const currentSQL = state.statement;
+ const newSQL = currentSQL ? `${currentSQL}\n\n${sql}` : sql;
+ handleStatementChange(newSQL);
+ state.showSchemaEditorDrawer = false;
+};
+
const showOverwriteConfirmDialog = () => {
return new Promise((resolve, reject) => {
// Show a confirm dialog before replacing if the editing statement is not empty.
diff --git a/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue b/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue
new file mode 100644
index 0000000000..60d9e593de
--- /dev/null
+++ b/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue
@@ -0,0 +1,194 @@
+<template>
+ <Drawer
+ v-model:show="show"
+ placement="right"
+ :resizable="true"
+ :default-width="'50%'"
+ :width="undefined"
+ class="max-w-[90vw]!"
+ >
+ <DrawerContent :title="$t('schema-editor.self')">
+ <div class="flex flex-col gap-y-4 h-full">
+ <!-- Database selector for multi-database scenarios -->
+ <div v-if="databases.length > 1" class="flex items-center gap-x-2">
+ <span class="text-sm text-control-light">
+ {{ $t("schema-editor.template-database") }}:
+ </span>
+ <NSelect
+ v-model:value="state.selectedDatabaseName"
+ :options="databaseOptions"
+ class="w-64"
+ @update:value="handleDatabaseChange"
+ />
+ </div>
+
+ <SchemaEditorLite
+ ref="schemaEditorRef"
+ :project="project"
+ :targets="editTargets"
+ :loading="state.isPreparingMetadata"
+ class="flex-1"
+ />
+ </div>
+
+ <template #footer>
+ <div class="flex items-center justify-end gap-x-2">
+ <NButton @click="handleCancel">
+ {{ $t("common.cancel") }}
+ </NButton>
+ <NButton
+ type="primary"
+ :disabled="!hasPendingChanges"
+ @click="handleInsertSQL"
+ >
+ {{ $t("schema-editor.insert-sql") }}
+ </NButton>
+ </div>
+ </template>
+ </DrawerContent>
+ </Drawer>
+</template>
+
+<script lang="ts" setup>
+import { cloneDeep } from "lodash-es";
+import { NButton, NSelect } from "naive-ui";
+import { computed, reactive, ref, watch } from "vue";
+import SchemaEditorLite, {
+ generateDiffDDL,
+ type EditTarget,
+} from "@/components/SchemaEditorLite";
+import { Drawer, DrawerContent } from "@/components/v2";
+import { useDBSchemaV1Store, useDatabaseCatalogV1Store } from "@/store";
+import type { ComposedDatabase } from "@/types";
+import type { Project } from "@/types/proto-es/v1/project_service_pb";
+
+const props = defineProps<{
+ show: boolean;
+ databases: ComposedDatabase[];
+ project: Project;
+}>();
+
+const emit = defineEmits<{
+ (event: "update:show", show: boolean): void;
+ (event: "insert", sql: string): void;
+}>();
+
+const show = computed({
+ get: () => props.show,
+ set: (value) => emit("update:show", value),
+});
+
+const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
+const dbSchemaStore = useDBSchemaV1Store();
+const dbCatalogStore = useDatabaseCatalogV1Store();
+
+const state = reactive({
+ isPreparingMetadata: false,
+ targets: [] as EditTarget[],
+ selectedDatabaseName: "",
+});
+
+const databaseOptions = computed(() => {
+ return props.databases.map((db) => ({
+ label: `${db.databaseName} (${db.instanceResource.title})`,
+ value: db.name,
+ }));
+});
+
+const selectedDatabase = computed(() => {
+ return (
+ props.databases.find((db) => db.name === state.selectedDatabaseName) ||
+ props.databases[0]
+ );
+});
+
+const editTargets = computed(() => state.targets);
+
+const hasPendingChanges = computed(() => {
+ return schemaEditorRef.value?.isDirty ?? false;
+});
+
+const prepareDatabaseMetadata = async (database: ComposedDatabase) => {
+ if (!database) return;
+
+ state.isPreparingMetadata = true;
+ state.targets = [];
+
+ const [metadata, catalog] = await Promise.all([
+ dbSchemaStore.getOrFetchDatabaseMetadata({
+ database: database.name,
+ skipCache: true,
+ limit: 200,
+ }),
+ dbCatalogStore.getOrFetchDatabaseCatalog({
+ database: database.name,
+ skipCache: true,
+ }),
+ ]);
+
+ state.targets = [
+ {
+ database: database,
+ metadata: cloneDeep(metadata),
+ baselineMetadata: metadata,
+ catalog: cloneDeep(catalog),
+ baselineCatalog: catalog,
+ },
+ ];
+
+ state.isPreparingMetadata = false;
+};
+
+const handleDatabaseChange = async () => {
+ if (selectedDatabase.value) {
+ await prepareDatabaseMetadata(selectedDatabase.value);
+ }
+};
+
+watch(
+ () => props.show,
+ (show) => {
+ if (show && props.databases.length > 0) {
+ // Initialize with first database
+ state.selectedDatabaseName = props.databases[0].name;
+ prepareDatabaseMetadata(props.databases[0]);
+ }
+ },
+ { immediate: true }
+);
+
+const handleCancel = () => {
+ show.value = false;
+};
+
+const handleInsertSQL = async () => {
+ const applyMetadataEdit = schemaEditorRef.value?.applyMetadataEdit;
+ if (typeof applyMetadataEdit !== "function") {
+ return;
+ }
+
+ const target = state.targets[0];
+ if (!target) return;
+
+ const { database, baselineMetadata, baselineCatalog } = target;
+ const { metadata, catalog } = applyMetadataEdit(
+ database,
+ target.metadata,
+ target.catalog
+ );
+
+ const result = await generateDiffDDL({
+ database,
+ sourceMetadata: baselineMetadata,
+ targetMetadata: metadata,
+ sourceCatalog: baselineCatalog,
+ targetCatalog: catalog,
+ allowEmptyDiffDDLWithConfigChange: false,
+ });
+
+ if (result.statement) {
+ emit("insert", result.statement);
+ show.value = false;
+ }
+};
+</script>
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
index 90154a3c20..f63d1158ae 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
@@ -37,13 +37,6 @@
</div>
</NScrollbar>
- <SchemaEditorModal
- v-if="state.showSchemaEditorModal"
- :database-names="selectedDatabaseNameList"
- :alter-type="'MULTI_DB'"
- @close="state.showSchemaEditorModal = false"
- />
-
<LabelEditorDrawer
:show="state.showLabelEditorDrawer"
:readonly="false"
@@ -121,7 +114,6 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import type { LocationQueryRaw } from "vue-router";
import { BBAlert } from "@/bbkit";
-import SchemaEditorModal from "@/components/AlterSchemaPrepForm/SchemaEditorModal.vue";
import EditEnvironmentDrawer from "@/components/EditEnvironmentDrawer.vue";
import LabelEditorDrawer from "@/components/LabelEditorDrawer.vue";
import { TransferDatabaseForm } from "@/components/TransferDatabaseForm";
@@ -146,7 +138,6 @@ import {
BatchUpdateDatabasesRequestSchema,
} from "@/types/proto-es/v1/database_service_pb";
import {
- allowUsingSchemaEditor,
extractProjectResourceName,
generateIssueTitle,
hasPermissionToCreateChangeDatabaseIssue,
@@ -165,7 +156,6 @@ interface DatabaseAction {
interface LocalState {
loading: boolean;
- showSchemaEditorModal: boolean;
showUnassignAlert: boolean;
showLabelEditorDrawer: boolean;
showEditEnvironmentDrawer: boolean;
@@ -182,7 +172,6 @@ const props = withDefaults(
const state = reactive<LocalState>({
loading: false,
- showSchemaEditorModal: false,
showUnassignAlert: false,
showLabelEditorDrawer: false,
showEditEnvironmentDrawer: false,
@@ -337,14 +326,6 @@ const generateMultiDb = async (
return;
}
}
- if (
- props.databases.length === 1 &&
- type === "bb.issue.database.schema.update" &&
- allowUsingSchemaEditor(props.databases)
- ) {
- state.showSchemaEditorModal = true;
- return;
- }
const query: LocationQueryRaw = {
template: type,
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 6db065b4b9..ca04de7693 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -911,7 +911,6 @@
"title": "Creator",
"description": "Search by the creator"
},
- "subscriber": {},
"approver": {
"title": "Approver",
"description": "Search by the issue approver"
@@ -1197,9 +1196,6 @@
"self": "No stages",
"description": "No stages are defined for this rollout."
}
- },
- "message": {
- "pervious-stages-incomplete": {}
}
},
"quick-action": {
@@ -1682,7 +1678,6 @@
"select-tip": "Please select a table to start."
},
"all": "All databases",
- "show-schemaless-databases": "Show schemaless databases. (Edit Schema is not applicable for schemaless databases.)",
"transfer": {
"errors": {
"select-target-project": "Select target project",
@@ -2153,12 +2148,10 @@
},
"schema-editor": {
"self": "Schema Editor",
- "preview-issue": "Preview issue",
- "sync-sql-from-schema-editor": "Sync SQL from Schema Editor",
"raw-sql": "Raw SQL",
"search-database-and-table": "Search database and table",
- "failed-to-generate-ddl-for-database": "Failed to generate the DDL for database {database}",
- "continue-with-empty-sql": "Continue with empty SQL",
+ "insert-sql": "Insert SQL",
+ "template-database": "Template database",
"actions": {
"create-schema": "Create schema",
"drop-schema": "Drop schema",
@@ -2220,8 +2213,6 @@
"duplicated-view-name": "Duplicated view name"
},
"confirm-to-close": {
- "title": "Confirm to close",
- "description": "Are you sure you want to close the panel? Your changes will be lost."
},
"foreign-key": {
"edit": "Edit foreign key",
@@ -2402,7 +2393,6 @@
"confirm-override-description": "Your rules will be overridden"
}
},
- "rule": {},
"enabled-rules": "Enabled rules",
"rule-detail": "Rule detail",
"view-definition": "View definition",
@@ -2843,8 +2833,6 @@
"vcs-type": {
"unspecified": "Unspecified"
},
- "actions": {},
- "messages": {},
"usage-description": "A release is a versioned application artifact whose deployment to an environment is triggered by a GitOps workflow."
},
"export-data": {
@@ -2897,8 +2885,7 @@
"algorithm": "Masking method",
"context": "Rule",
"classification": "Classification level"
- },
- "algorithms": {}
+ }
},
"landing": {
"quick-link": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index aa470b27ba..bb092d0275 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -911,7 +911,6 @@
"title": "Creador",
"description": "Búsqueda por creador"
},
- "subscriber": {},
"approver": {
"title": "Aprobador",
"description": "Búsqueda por aprobador del problema"
@@ -1197,9 +1196,6 @@
"self": "Sin etapas",
"description": "No se definen etapas para este lanzamiento."
}
- },
- "message": {
- "pervious-stages-incomplete": {}
}
},
"quick-action": {
@@ -1682,7 +1678,6 @@
"select-tip": "Seleccione una mesa para comenzar."
},
"all": "Todas las bases de datos",
- "show-schemaless-databases": "Mostrar bases de datos sin esquema. (Editar Schema no se aplica a las bases de datos sin esquema.)",
"transfer": {
"errors": {
"select-target-project": "Seleccionar proyecto de destino",
@@ -2153,12 +2148,10 @@
},
"schema-editor": {
"self": "Editor de esquema",
- "preview-issue": "Vista previa de incidencia",
- "sync-sql-from-schema-editor": "Sincronizar SQL desde el Editor de esquema",
"raw-sql": "SQL sin procesar",
"search-database-and-table": "Buscar base de datos y tabla",
- "failed-to-generate-ddl-for-database": "Error al generar el DDL para la base de datos {database}",
- "continue-with-empty-sql": "Continuar con SQL vacío",
+ "insert-sql": "Insert SQL",
+ "template-database": "Template database",
"actions": {
"create-schema": "Crear esquema",
"drop-schema": "Eliminar esquema",
@@ -2220,8 +2213,6 @@
"duplicated-view-name": "Nombre de vista duplicado"
},
"confirm-to-close": {
- "title": "Confirmar para cerrar",
- "description": "¿Está seguro de que desea cerrar el panel? Se perderán los cambios realizados."
},
"foreign-key": {
"edit": "Editar clave externa",
@@ -2402,7 +2393,6 @@
"confirm-override-description": "Sus reglas serán anuladas"
}
},
- "rule": {},
"enabled-rules": "Reglas habilitadas",
"rule-detail": "Detalle de la regla",
"view-definition": "Ver definición",
@@ -2843,8 +2833,6 @@
"vcs-type": {
"unspecified": "No especificado"
},
- "actions": {},
- "messages": {},
"usage-description": "Un lanzamiento es un artefacto de aplicación versionado cuyo despliegue a un entorno es activado por un flujo de trabajo GitOps."
},
"export-data": {
@@ -2897,8 +2885,7 @@
"algorithm": "Método de enmascaramiento",
"context": "Regla",
"classification": "Nivel de clasificación"
- },
- "algorithms": {}
+ }
},
"landing": {
"quick-link": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 3618ea8abe..966bb2a157 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -911,7 +911,6 @@
"title": "作成者",
"description": "作成者で検索"
},
- "subscriber": {},
"approver": {
"title": "承認者",
"description": "イシューの承認者で検索"
@@ -1197,9 +1196,6 @@
"self": "ステージなし",
"description": "このロールアウトにはステージが定義されていません。"
}
- },
- "message": {
- "pervious-stages-incomplete": {}
}
},
"quick-action": {
@@ -1682,7 +1678,6 @@
"select-tip": "開始するにはテーブルを選択してください。"
},
"all": "すべてのデータベース",
- "show-schemaless-databases": "スキーマレス データベースを示します。 (スキーマの変更は、スキーマのないデータベースでは機能しません。)",
"transfer": {
"errors": {
"select-target-project": "対象プロジェクトを選択",
@@ -2153,12 +2148,10 @@
},
"schema-editor": {
"self": "スキーマエディタ",
- "preview-issue": "イシューのプレビュー",
- "sync-sql-from-schema-editor": "スキーマエディタからSQLを同期する",
"raw-sql": "SQL文",
"search-database-and-table": "データベースとテーブルを検索する",
- "failed-to-generate-ddl-for-database": "データベース {database} の DDL 生成に失敗しました",
- "continue-with-empty-sql": "空のSQLで続行",
+ "insert-sql": "Insert SQL",
+ "template-database": "Template database",
"actions": {
"create-schema": "新しいスキーマ",
"drop-schema": "スキーマの削除",
@@ -2220,8 +2213,6 @@
"duplicated-view-name": "重複したビュー名"
},
"confirm-to-close": {
- "title": "閉じることを確認しますか?",
- "description": "変更は閉じると失われます。"
},
"foreign-key": {
"edit": "外部キーを編集",
@@ -2402,7 +2393,6 @@
"confirm-override-description": "以前のルールは上書きされます"
}
},
- "rule": {},
"enabled-rules": "開かれたルールの数",
"rule-detail": "ルールの詳細",
"view-definition": "ビューの定義",
@@ -2843,8 +2833,6 @@
"vcs-type": {
"unspecified": "未指定"
},
- "actions": {},
- "messages": {},
"usage-description": "リリースは、GitOpsワークフローによって環境へのデプロイがトリガーされるバージョン管理されたアプリケーションアーティファクトです。"
},
"export-data": {
@@ -2897,8 +2885,7 @@
"algorithm": "マスキング方法",
"context": "ルール",
"classification": "分類レベル"
- },
- "algorithms": {}
+ }
},
"landing": {
"quick-link": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 87d383bcc0..1e327ec342 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -911,7 +911,6 @@
"title": "Người tạo",
"description": "Tìm kiếm theo người sáng tạo"
},
- "subscriber": {},
"approver": {
"title": "Người phê duyệt",
"description": "Tìm kiếm theo người phê duyệt vấn đề"
@@ -1197,9 +1196,6 @@
"self": "Không có giai đoạn",
"description": "Không có giai đoạn nào được xác định cho lần triển khai này."
}
- },
- "message": {
- "pervious-stages-incomplete": {}
}
},
"quick-action": {
@@ -1682,7 +1678,6 @@
"select-tip": "Vui lòng chọn một bảng để bắt đầu."
},
"all": "Tất cả cơ sở dữ liệu",
- "show-schemaless-databases": "Hiển thị cơ sở dữ liệu không có lược đồ. (Chỉnh sửa lược đồ không áp dụng cho cơ sở dữ liệu không có lược đồ.)",
"transfer": {
"errors": {
"select-target-project": "Chọn dự án đích",
@@ -2153,12 +2148,10 @@
},
"schema-editor": {
"self": "Trình soạn thảo lược đồ",
- "preview-issue": "Xem trước vấn đề",
- "sync-sql-from-schema-editor": "Đồng bộ SQL từ Trình soạn thảo lược đồ",
"raw-sql": "SQL thô",
"search-database-and-table": "Tìm kiếm cơ sở dữ liệu và bảng",
- "failed-to-generate-ddl-for-database": "Không thể tạo DDL cho cơ sở dữ liệu {database}",
- "continue-with-empty-sql": "Tiếp tục với SQL trống",
+ "insert-sql": "Insert SQL",
+ "template-database": "Template database",
"actions": {
"create-schema": "Tạo lược đồ",
"drop-schema": "Xóa lược đồ",
@@ -2220,8 +2213,6 @@
"duplicated-view-name": "Tên khung nhìn trùng lặp"
},
"confirm-to-close": {
- "title": "Xác nhận đóng",
- "description": "Bạn có chắc chắn muốn đóng bảng điều khiển không? Thay đổi của bạn sẽ bị mất."
},
"foreign-key": {
"edit": "Chỉnh sửa khóa ngoại",
@@ -2402,7 +2393,6 @@
"confirm-override-description": "Quy tắc của bạn sẽ bị ghi đè"
}
},
- "rule": {},
"enabled-rules": "Quy tắc được bật",
"rule-detail": "Chi tiết quy tắc",
"view-definition": "Xem định nghĩa",
@@ -2843,8 +2833,6 @@
"vcs-type": {
"unspecified": "Không xác định"
},
- "actions": {},
- "messages": {},
"usage-description": "Bản phát hành là một artifact ứng dụng có phiên bản mà việc triển khai vào môi trường được kích hoạt bởi quy trình GitOps."
},
"export-data": {
@@ -2897,8 +2885,7 @@
"algorithm": "Phương pháp che dữ liệu",
"context": "Quy tắc",
"classification": "Mức phân loại"
- },
- "algorithms": {}
+ }
},
"landing": {
"quick-link": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 069e138f45..5a993690ec 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -911,7 +911,6 @@
"title": "创建人",
"description": "根据创建人搜索"
},
- "subscriber": {},
"approver": {
"title": "审批人",
"description": "根据工单审批人搜索"
@@ -1197,9 +1196,6 @@
"self": "没有阶段",
"description": "本次发布任务未定义任何阶段。"
}
- },
- "message": {
- "pervious-stages-incomplete": {}
}
},
"quick-action": {
@@ -1682,7 +1678,6 @@
"select-tip": "请选择一个表来开始查询。"
},
"all": "所有数据库",
- "show-schemaless-databases": "显示无模式的数据库。(变更 Schema 不适用于无 schema 的数据库. )",
"transfer": {
"errors": {
"select-target-project": "选择目标项目",
@@ -2153,12 +2148,10 @@
},
"schema-editor": {
"self": "Schema 编辑器",
- "preview-issue": "预览工单",
- "sync-sql-from-schema-editor": "从 Schema 编辑器中同步 SQL",
"raw-sql": "SQL 语句",
"search-database-and-table": "搜索数据库和表",
- "failed-to-generate-ddl-for-database": "无法为数据库 {database} 生成 DDL",
- "continue-with-empty-sql": "使用空 SQL 创建工单",
+ "insert-sql": "插入 SQL",
+ "template-database": "模板数据库",
"actions": {
"create-schema": "新建 Schema",
"drop-schema": "删除 Schema",
@@ -2220,8 +2213,6 @@
"duplicated-view-name": "重复的视图名称"
},
"confirm-to-close": {
- "title": "确定关闭?",
- "description": "关闭后更改将会丢失。"
},
"foreign-key": {
"edit": "修改外键",
@@ -2402,7 +2393,6 @@
"confirm-override-description": "之前的规则将会被覆盖"
}
},
- "rule": {},
"enabled-rules": "开启的规则数",
"rule-detail": "规则详情",
"view-definition": "查看定义",
@@ -2843,8 +2833,6 @@
"vcs-type": {
"unspecified": "未指定"
},
- "actions": {},
- "messages": {},
"usage-description": "发布包是版本化的应用制品。GitOps 工作流将发布包部署到环境。"
},
"export-data": {
@@ -2897,8 +2885,7 @@
"algorithm": "遮盖方法",
"context": "规则",
"classification": "分类级别"
- },
- "algorithms": {}
+ }
},
"landing": {
"quick-link": {
diff --git a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
index fefd0f923a..27db7aa3a4 100644
--- a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
@@ -181,13 +181,6 @@
@dismiss="state.showTransferDatabaseModal = false"
/>
</Drawer>
-
- <SchemaEditorModal
- v-if="state.showSchemaEditorModal"
- :database-names="[database.name]"
- alter-type="SINGLE_DB"
- @close="state.showSchemaEditorModal = false"
- />
</template>
<script lang="ts" setup>
@@ -199,7 +192,6 @@ import { computed, reactive, watch, watchEffect } from "vue";
import { useRouter, useRoute, type LocationQueryRaw } from "vue-router";
import { BBModal } from "@/bbkit";
import { BBAttention } from "@/bbkit";
-import SchemaEditorModal from "@/components/AlterSchemaPrepForm/SchemaEditorModal.vue";
import DatabaseChangelogPanel from "@/components/Database/DatabaseChangelogPanel.vue";
import DatabaseOverviewPanel from "@/components/Database/DatabaseOverviewPanel.vue";
import DatabaseRevisionPanel from "@/components/Database/DatabaseRevisionPanel.vue";
@@ -231,11 +223,9 @@ import {
instanceNamePrefix,
} from "@/store/modules/v1/common";
import { UNKNOWN_PROJECT_NAME } from "@/types";
-import { State } from "@/types/proto-es/v1/common_pb";
import {
instanceV1HasAlterSchema,
isDatabaseV1Queryable,
- engineSupportsSchemaEditor,
extractProjectResourceName,
} from "@/utils";
@@ -253,7 +243,6 @@ const isDatabaseHash = (x: any): x is DatabaseHash =>
interface LocalState {
showTransferDatabaseModal: boolean;
showIncorrectProjectModal: boolean;
- showSchemaEditorModal: boolean;
currentProjectName: string;
selectedIndex: number;
selectedTab: DatabaseHash;
@@ -270,7 +259,6 @@ const router = useRouter();
const state = reactive<LocalState>({
showTransferDatabaseModal: false,
showIncorrectProjectModal: false,
- showSchemaEditorModal: false,
currentProjectName: UNKNOWN_PROJECT_NAME,
selectedIndex: 0,
selectedTab: "overview",
@@ -351,16 +339,6 @@ const tryTransferProject = () => {
const createMigration = async (
type: "bb.issue.database.schema.update" | "bb.issue.database.data.update"
) => {
- if (type === "bb.issue.database.schema.update") {
- if (
- database.value.state === State.ACTIVE &&
- engineSupportsSchemaEditor(database.value.instanceResource.engine)
- ) {
- state.showSchemaEditorModal = true;
- return;
- }
- }
-
// Create a user friendly default issue name
const issueNameParts: string[] = [];
issueNameParts.push(`[${database.value.databaseName}]`);