Skip to content

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

fix: perform correctly when table.indexList is empty (#1074)

Liu Jiafafb4e63164
diff --git a/frontend/src/store/modules/table.ts b/frontend/src/store/modules/table.ts
index 1b971b5200..2171a1ab40 100644
--- a/frontend/src/store/modules/table.ts
+++ b/frontend/src/store/modules/table.ts
@@ -1,10 +1,12 @@
import axios from "axios";
import {
+ Column,
Database,
DatabaseId,
ResourceIdentifier,
ResourceObject,
Table,
+ TableIndex,
TableState,
unknown,
} from "../../types";
@@ -26,10 +28,13 @@ function convert(
}
}
+ const columnList = (table.attributes.columnList as Column[]) || [];
+ const indexList = (table.attributes.indexList as TableIndex[]) || [];
+
return {
...(table.attributes as Omit<
Table,
- "id" | "database" | "creator" | "updater"
+ "id" | "database" | "creator" | "updater" | "columnList" | "indexList"
>),
id: parseInt(table.id),
creator: getPrincipalFromIncludedList(
@@ -40,6 +45,8 @@ function convert(
table.relationships!.updater.data,
includedList
),
+ columnList,
+ indexList,
database,
};
}
diff --git a/frontend/src/types/table.ts b/frontend/src/types/table.ts
index eac141f0bd..200d1094ac 100644
--- a/frontend/src/types/table.ts
+++ b/frontend/src/types/table.ts
@@ -2,6 +2,7 @@ import { Column } from "./column";
import { Database } from "./database";
import { TableId } from "./id";
import { Principal } from "./principal";
+import { TableIndex } from "./tableIndex";
export type TableType = "BASE TABLE" | "VIEW";
export type TableEngineType = "InnoDB";
@@ -26,6 +27,7 @@ export type Table = {
collation: string;
rowCount: number;
dataSize: number;
+ indexList: TableIndex[];
indexSize: number;
dataFree: number;
createOptions: string;