MCPcopy Create free account
hub / github.com/bytebase/bytebase / normalizeLegacyMetadata

Function normalizeLegacyMetadata

backend/plugin/schema/pg/legacy_normalize.go:40–55  ·  view source on GitHub ↗

normalizeLegacyMetadata mutates meta in place to match the canonical IndexMetadata.expressions contract. Idempotent and cheap on canonical input.

(meta *storepb.DatabaseSchemaMetadata)

Source from the content-addressed store, hash-verified

38// normalizeLegacyMetadata mutates meta in place to match the canonical
39// IndexMetadata.expressions contract. Idempotent and cheap on canonical input.
40func normalizeLegacyMetadata(meta *storepb.DatabaseSchemaMetadata) {
41 if meta == nil {
42 return
43 }
44 for _, s := range meta.GetSchemas() {
45 for _, t := range s.GetTables() {
46 canonicalizeIndexExpressions(t.GetIndexes())
47 for _, p := range t.GetPartitions() {
48 canonicalizePartitionIndexes(p)
49 }
50 }
51 for _, mv := range s.GetMaterializedViews() {
52 canonicalizeIndexExpressions(mv.GetIndexes())
53 }
54 }
55}
56
57func canonicalizePartitionIndexes(p *storepb.TablePartitionMetadata) {
58 if p == nil {

Calls 7

GetSchemasMethod · 0.45
GetTablesMethod · 0.45
GetIndexesMethod · 0.45
GetPartitionsMethod · 0.45
GetMaterializedViewsMethod · 0.45