MCPcopy
hub / github.com/dnote/dnote / getUnrunMigrations

Function getUnrunMigrations

pkg/cli/migrate/legacy.go:258–276  ·  view source on GitHub ↗
(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

256}
257
258func getUnrunMigrations(ctx context.DnoteCtx) ([]int, error) {
259 var ret []int
260
261 schema, err := readSchema(ctx)
262 if err != nil {
263 return ret, errors.Wrap(err, "Failed to read schema")
264 }
265
266 log.Debug("current legacy schema: %d\n", schema.CurrentVersion)
267
268 if schema.CurrentVersion == len(migrationSequence) {
269 return ret, nil
270 }
271
272 nextVersion := schema.CurrentVersion
273 ret = migrationSequence[nextVersion:]
274
275 return ret, nil
276}
277
278func updateSchemaVersion(ctx context.DnoteCtx, mID int) error {
279 s, err := readSchema(ctx)

Callers 1

LegacyFunction · 0.85

Calls 2

DebugFunction · 0.92
readSchemaFunction · 0.85

Tested by

no test coverage detected