Skip to content

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

fix(frontend): legacy API corner cases (#6491)

Liu Ji82c852db44c8
diff --git a/frontend/src/store/modules/dbSchema.ts b/frontend/src/store/modules/dbSchema.ts
index 2c7f0e4d60..57d951f7c1 100644
--- a/frontend/src/store/modules/dbSchema.ts
+++ b/frontend/src/store/modules/dbSchema.ts
@@ -21,6 +21,12 @@ export const useDBSchemaStore = defineStore("dbSchema", {
databaseId: DatabaseId,
skipCache = false
): Promise<DatabaseMetadata> {
+ if (Number(databaseId) === UNKNOWN_ID) {
+ return DatabaseMetadata.fromJSON({
+ name: "<<Unknown database>>",
+ });
+ }
+
if (!skipCache) {
if (this.databaseMetadataById.has(databaseId)) {
// The metadata entity is stored in local dictionary.
diff --git a/frontend/src/views/SyncDatabaseSchema/index.vue b/frontend/src/views/SyncDatabaseSchema/index.vue
index cdbea5fe48..871422d904 100644
--- a/frontend/src/views/SyncDatabaseSchema/index.vue
+++ b/frontend/src/views/SyncDatabaseSchema/index.vue
@@ -84,18 +84,16 @@
:show-prefix-item="databaseChangeHistoryList(state.sourceSchema.databaseId as string).length > 0"
@select-item="(changeHistory: ChangeHistory) => handleSchemaVersionSelect(changeHistory)"
>
- <template #menuItem="{ item: migrationHistory }">
+ <template
+ #menuItem="{ item: changeHistory }: { item: ChangeHistory }"
+ >
<div class="flex justify-between mr-2">
<NEllipsis class="pr-2" :tooltip="false">
- {{ migrationHistory.version }} -
- {{ migrationHistory.description }}
+ {{ changeHistory.version }} -
+ {{ changeHistory.description }}
</NEllipsis>
<span class="text-control-light">
- {{
- dayjs(migrationHistory.updatedTs * 1000).format(
- "YYYY-MM-DD HH:mm:ss"
- )
- }}
+ {{ humanizeDate(changeHistory.updateTime) }}
</span>
</div>
</template>
@@ -406,7 +404,9 @@ watch(
state.sourceSchema.changeHistory = head(changeHistoryList);
} else {
// If database has no migration history, we will use its latest schema.
- const schema = await databaseStore.fetchDatabaseSchema(database.name);
+ const schema = await databaseStore.fetchDatabaseSchema(
+ `${database.name}/schema`
+ );
state.sourceSchema.changeHistory = {
name: `${database.name}/changeHistories/${UNKNOWN_ID}`,
uid: String(UNKNOWN_ID),