MCPcopy Index your code
hub / github.com/dnote/dnote / migrateToV1

Function migrateToV1

pkg/cli/migrate/legacy.go:483–498  ·  view source on GitHub ↗

***** migrations **/ migrateToV1 deletes YAML archive if exists

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

481
482// migrateToV1 deletes YAML archive if exists
483func migrateToV1(ctx context.DnoteCtx) error {
484 yamlPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, ".dnote-yaml-archived")
485 ok, err := utils.FileExists(yamlPath)
486 if err != nil {
487 return errors.Wrap(err, "checking if yaml file exists")
488 }
489 if !ok {
490 return nil
491 }
492
493 if err := os.Remove(yamlPath); err != nil {
494 return errors.Wrap(err, "Failed to delete .dnote archive")
495 }
496
497 return nil
498}
499
500func migrateToV2(ctx context.DnoteCtx) error {
501 notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote)

Callers 2

performMigrationFunction · 0.85
TestMigrateToV1Function · 0.85

Calls 1

FileExistsFunction · 0.92

Tested by 1

TestMigrateToV1Function · 0.68