Skip to content

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

chore: fixed Duration field conversion from object to string format du… (#16684)

Vincent Huang137ea61521ad
diff --git a/frontend/src/utils/v1/instance-conversions.ts b/frontend/src/utils/v1/instance-conversions.ts
index ed735b9305..4eb0ff9ddd 100644
--- a/frontend/src/utils/v1/instance-conversions.ts
+++ b/frontend/src/utils/v1/instance-conversions.ts
@@ -24,6 +24,18 @@ import {
export const convertOldInstanceToNew = (oldInstance: OldInstance): NewInstance => {
// Use toJSON to convert old proto to JSON, then fromJson to convert to proto-es
const json = OldInstanceProto.toJSON(oldInstance) as any; // Type assertion needed due to proto type incompatibility
+
+ // Fix Duration fields: proto-es expects string format, old proto outputs object
+ if (json.syncInterval && typeof json.syncInterval === 'object') {
+ const duration = json.syncInterval as { seconds?: string | number; nanos?: number };
+ if (!duration.seconds && !duration.nanos) {
+ delete json.syncInterval;
+ } else {
+ const seconds = Number(duration.seconds || 0) + (duration.nanos || 0) / 1e9;
+ json.syncInterval = `${seconds}s`;
+ }
+ }
+
return fromJson(InstanceSchema, json);
};