Function: org-roam-migrate-wizard

org-roam-migrate-wizard is an interactive and natively compiled function defined in org-roam-migrate.el.

Signature

(org-roam-migrate-wizard)

Documentation

Migrate all notes from to be compatible with Org-roam v2.

1. Convert all notes from v1 format to v2.
2. Rebuild the cache.
3. Replace all file links with ID links.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/60hpqw2cczhjli65ml5v1p4g0q2kbyhb-emacs-packages-deps/share/emacs/site-lisp/elpa/org-roam-20260425.1623/org-roam-migrate.el
;;; Migration wizard (v1 -> v2)
;;;###autoload
(defun org-roam-migrate-wizard ()
  "Migrate all notes from to be compatible with Org-roam v2.
1. Convert all notes from v1 format to v2.
2. Rebuild the cache.
3. Replace all file links with ID links."
  (interactive)
  (when (yes-or-no-p "Org-roam will now convert all your notes from v1 to v2.
This will take a while. Are you sure you want to do this?")
    ;; Back up notes
    (let ((backup-dir (expand-file-name "org-roam.bak"
                                        (file-name-directory (directory-file-name org-roam-directory)))))
      (message "Backing up files to %s" backup-dir)
      (copy-directory org-roam-directory backup-dir))

    ;; Upgrade database to v2
    (org-roam-db-sync 'force)

    ;; Convert v1 to v2
    (dolist (f (org-roam-list-files))
      (org-roam-with-file f nil
        (org-roam-migrate-v1-to-v2)))

    ;; Rebuild cache
    (org-roam-db-sync 'force)

    ;;Replace all file links with ID links
    (dolist (f (org-roam-list-files))
      (org-roam-with-file f nil
        (org-roam-migrate-replace-file-links-with-id)
        (save-buffer)))))