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(schema-editor): re-organize schema editor engine specs (#11690)
Liu Jica377f4f1d76
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vueindex d205faded9..0f6ef33a2a 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue@@ -50,6 +50,7 @@</NButton></template><NButton+ v-if="engineSupportsEditIndexes(engine)"size="small":disabled="disableChangeTable"@click="state.mode = 'INDEXES'"@@ -62,7 +63,7 @@}}</NButton><NButton- v-if="hasTablePartitionsFeature"+ v-if="engineSupportsEditTablePartitions(engine)"size="small":disabled="disableChangeTable"@click="state.mode = 'PARTITIONS'"@@ -201,7 +202,6 @@ import type { SchemaTemplateSetting_FieldTemplate } from "@/types/proto/v1/settiimport {arraySwap,instanceV1AllowsReorderColumns,- instanceV1SupportsTablePartition,randomString,} from "@/utils";import FieldTemplates from "@/views/SchemaTemplate/FieldTemplates.vue";@@ -212,6 +212,10 @@ import {removeColumnPrimaryKey,upsertColumnPrimaryKey,} from "../edit";+import {+ engineSupportsEditIndexes,+ engineSupportsEditTablePartitions,+} from "../spec";import type { EditStatus } from "../types";import ColumnSelectionSummary from "./ColumnSelectionSummary.vue";import IndexesEditor from "./IndexesEditor";@@ -332,10 +336,6 @@ const allowReorderColumns = computed(() => {return instanceV1AllowsReorderColumns(engine.value) && status === "created";});-const hasTablePartitionsFeature = computed(() => {- return instanceV1SupportsTablePartition(engine.value);-});-const disableAlterColumn = (column: ColumnMetadata): boolean => {return (isDroppedSchema.value || isDroppedTable.value || isDroppedColumn(column)diff --git a/frontend/src/components/SchemaEditorLite/index.ts b/frontend/src/components/SchemaEditorLite/index.tsindex 52fb98116f..7372ebd2d8 100644--- a/frontend/src/components/SchemaEditorLite/index.ts+++ b/frontend/src/components/SchemaEditorLite/index.ts@@ -2,4 +2,5 @@ import SchemaEditorLite from "./SchemaEditorLite.vue";export * from "./types";export * from "./common";+export * from "./spec";export default SchemaEditorLite;diff --git a/frontend/src/components/SchemaEditorLite/spec.ts b/frontend/src/components/SchemaEditorLite/spec.tsnew file mode 100644index 0000000000..f8c01ac600--- /dev/null+++ b/frontend/src/components/SchemaEditorLite/spec.ts@@ -0,0 +1,17 @@+import { Engine } from "@/types/proto/v1/common";++export const engineSupportsEditIndexes = (engine: Engine) => {+ return [Engine.MYSQL, Engine.TIDB].includes(engine);+};++export const engineSupportsEditTablePartitions = (engine: Engine) => {+ return [Engine.MYSQL, Engine.TIDB].includes(engine);+};++export const engineSupportsEditProcedures = (engine: Engine) => {+ return [Engine.MYSQL, Engine.TIDB].includes(engine);+};++export const engineSupportsEditFunctions = (engine: Engine) => {+ return [Engine.MYSQL, Engine.TIDB].includes(engine);+};