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

Function MetadataToSDL

backend/plugin/schema/schema.go:335–347  ·  view source on GitHub ↗

MetadataToSDL converts database metadata to SDL text using the registered GetDatabaseDefinition.

(engine storepb.Engine, meta *model.DatabaseMetadata)

Source from the content-addressed store, hash-verified

333
334// MetadataToSDL converts database metadata to SDL text using the registered GetDatabaseDefinition.
335func MetadataToSDL(engine storepb.Engine, meta *model.DatabaseMetadata) (string, error) {
336 if meta == nil {
337 return "", nil
338 }
339 proto := meta.GetProto()
340 if proto == nil {
341 return "", nil
342 }
343 return GetDatabaseDefinition(engine, GetDefinitionContext{
344 SkipBackupSchema: true,
345 SDLFormat: true,
346 }, proto)
347}
348
349func RegisterDiffSDLMigration(engine storepb.Engine, f diffSDLMigration) {
350 mux.Lock()

Calls 2

GetDatabaseDefinitionFunction · 0.70
GetProtoMethod · 0.45