Skip to content

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

chore: disallow to edit pk for tidb (#12530)

boojack544e07618b9d
diff --git a/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue
index ff73b15d01..6ed82a6345 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue
@@ -33,6 +33,7 @@ import { computed, h, ref } from "vue";
import { useI18n } from "vue-i18n";
import { InlineInput } from "@/components/v2";
import type { ComposedDatabase } from "@/types";
+import { Engine } from "@/types/proto/v1/common";
import type {
DatabaseMetadata,
IndexMetadata,
@@ -171,6 +172,11 @@ const columns = computed(() => {
className: "checkbox-cell",
render: (index) => {
const allowTurnOnOrOffPrimary = () => {
+ // Do not allow to edit primary key for TiDB.
+ if (props.db.instanceEntity.engine === Engine.TIDB) {
+ return false;
+ }
+
if (index.primary) return true;
return !props.table.indexes.some((idx) => idx.primary);
};