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)
| 269 | // current database schema. It converts the current metadata to SDL, then diffs |
| 270 | // against the user SDL using DiffSDLMigration. |
| 271 | func 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 | |
| 279 | func RegisterSDLDropAdvices(engine storepb.Engine, f sdlDropAdvices) { |
| 280 | mux.Lock() |