Skip to content

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

fix: changelog (#14879)

p0ny8fe914c03807
diff --git a/backend/api/v1/database_service_changelog.go b/backend/api/v1/database_service_changelog.go
index 057c4eb9a1..2c887fc1bb 100644
--- a/backend/api/v1/database_service_changelog.go
+++ b/backend/api/v1/database_service_changelog.go
@@ -154,11 +154,13 @@ func (s *DatabaseService) GetChangelog(ctx context.Context, request *v1pb.GetCha
return nil, status.Errorf(codes.Internal, "failed to convert schema to sdl format, error %v", err.Error())
}
converted.Schema = sdlSchema
+ converted.SchemaSize = int64(len(sdlSchema))
sdlSchema, err = transform.SchemaTransform(storepb.Engine_MYSQL, converted.PrevSchema)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to convert previous schema to sdl format, error %v", err.Error())
}
converted.PrevSchema = sdlSchema
+ converted.PrevSchemaSize = int64(len(sdlSchema))
}
}
if request.Concise {
@@ -169,12 +171,14 @@ func (s *DatabaseService) GetChangelog(ctx context.Context, request *v1pb.GetCha
return nil, status.Errorf(codes.Internal, "failed to get concise schema, error %v", err.Error())
}
converted.Schema = conciseSchema
+ converted.SchemaSize = int64(len(conciseSchema))
case storepb.Engine_POSTGRES:
conciseSchema, err := pg.FilterBackupSchema(converted.Schema)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to filter the backup schema, error %v", err.Error())
}
converted.Schema = conciseSchema
+ converted.SchemaSize = int64(len(conciseSchema))
default:
return nil, status.Errorf(codes.Unimplemented, "concise schema is not supported for engine %q", instance.Engine.String())
}
diff --git a/backend/store/changelog.go b/backend/store/changelog.go
index 69e167cf16..5aee0d3f73 100644
--- a/backend/store/changelog.go
+++ b/backend/store/changelog.go
@@ -161,7 +161,7 @@ func (s *Store) ListChangelogs(ctx context.Context, find *FindChangelogMessage)
}
}
if find.HasSyncHistory {
- where = append(where, "changelog.sync_history IS NOT NULL")
+ where = append(where, "changelog.sync_history_id IS NOT NULL")
}
if len(find.TypeList) > 0 {
where = append(where, fmt.Sprintf("changelog.payload->>'type' = ANY($%d)", len(args)+1))