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

Function SDLMigration

backend/plugin/schema/schema.go:271–277  ·  view source on GitHub ↗

SDLMigration computes the migration SQL from a user-provided SDL text and the current database schema. It converts the current metadata to SDL, then diffs against the user SDL using DiffSDLMigration.

(engine storepb.Engine, userSDLText string, currentSchema *model.DatabaseMetadata)

Source from the content-addressed store, hash-verified

269// current database schema. It converts the current metadata to SDL, then diffs
270// against the user SDL using DiffSDLMigration.
271func SDLMigration(engine storepb.Engine, userSDLText string, currentSchema *model.DatabaseMetadata) (string, error) {
272 sourceSDL, err := MetadataToSDL(engine, currentSchema)
273 if err != nil {
274 return "", errors.Wrap(err, "failed to convert current schema to SDL")
275 }
276 return DiffSDLMigration(engine, sourceSDL, userSDLText)
277}
278
279func RegisterSDLDropAdvices(engine storepb.Engine, f sdlDropAdvices) {
280 mux.Lock()

Callers 2

diffFunction · 0.92

Calls 2

MetadataToSDLFunction · 0.85
DiffSDLMigrationFunction · 0.85