# New default DB file location, and how to keep using the current DB file as is via customizing

**URL:** <https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821>\
**Category:** Tips\
**Created:** [October 5, 2020, 4:42pm UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821 "2020-10-05T16:42:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [October 5, 2020, 4:42pm UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821/1 "2020-10-05T16:42:08Z")

</div>

Very recent (about 5 hours ago as I write this) commit [`32bf910`](https://github.com/org-roam/org-roam/commit/32bf91077e01fbfbaa23eeaef23400e3d8ec64b2) introduces a new default location for your `org-roam.db` file.

> Move the default location of `org-roam.db` to the user’s Emacs  
> directory. This is a more sensible default: those who sync their  
> Org files would not have the database synced over as well.

Good change if you sync your notes via Cloud sync services (you would not need to explicitly exclude the `.db` file from sync).

This change might surprise you if you have used Org-roam since before this change, as Org-roam would try to build another database file from scratch. Depending on the size of your notes repository, it might take noticeable time.

There is no harm using a new file in the new default location.

But for whatever reason, if you prefer to keep using the DB file you have already built, you can tell Org-roam to do so by using this customizing variable.

It exists before the change, so you can set it up before you update your Org-roam package.

* * *

`(setq org-roam-db-location "c:/Users/nobiot/org-roam/org-roam.db")`

or via customizing like this:

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/489b236929ff93975b3ac5535864bea0b13b1cef.png)

---

<div class="post-metadata">

**Author:** ![jethro](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jethro](https://org-roam.discourse.group/u/jethro)\
**Post date:** [October 5, 2020, 6:48pm UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821/2 "2020-10-05T18:48:07Z")

</div>

Or, if you don’t wish to rebuild the database from scratch, it is possible (I think) to simply move the db file over without any issues 😄

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [October 5, 2020, 8:42pm UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821/3 "2020-10-05T20:42:50Z")

</div>

I have a feeling you might also need to move/copy the org-id file (?) I don’t use IDs, so can’t be sure 😅

---

<div class="post-metadata">

**Author:** ![holtzermann17](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/holtzermann17/32/377_2.png) [@holtzermann17](https://org-roam.discourse.group/u/holtzermann17)\
**Post date:** [October 5, 2020, 10:23pm UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821/4 "2020-10-05T22:23:10Z")

</div>

BTW, in my workflow I’m using multiple different database files. This works a treat:

```
(defvar org-roam-library `(,(concat "/home/" (getenv "USER") "/arxana/org-roam/")
                           ,(concat "/home/" (getenv "USER") "/org-roam/")
                           ,(concat "/home/" (getenv "USER") "/eightfold-path/")
                           ,(concat "/home/" (getenv "USER") "/PeeragogyORG/")))

(defun org-roam-checkout ()
  (interactive)
  (let ((ctx org-roam-directory))
    (if (eq (length org-roam-library) 1)
        ;; Still go ahead and set the variable in this case!
        (progn (setq org-roam-directory (car org-roam-library))
               (message "You only have one choice for org-roam-directory defined."))
      (let ((lib (completing-read "Choose a volume: " org-roam-library)))
        (when lib
          (setq org-roam-directory lib))))
    ;; assuming the user changes context, let’s also prompt them
    ;; to choose a new file in that context
    (when (not (eq ctx org-roam-directory))
      (org-roam-find-file))))

```

It looks like in light of the change, the `org-roam-checkout` function should be adjusted to set the `org-roam-db-location` as well as the `org-roam-directory`. Will sort it out shortly…

---

<div class="post-metadata">

**Author:** ![jethro](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jethro](https://org-roam.discourse.group/u/jethro)\
**Post date:** [October 6, 2020, 3:42am UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821/5 "2020-10-06T03:42:48Z")

</div>

Nope, Org-roam caches the IDs and uses it to navigate, rather than rely on Org’s file cache mechanism

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [October 6, 2020, 7:56am UTC](https://org-roam.discourse.group/t/new-default-db-file-location-and-how-to-keep-using-the-current-db-file-as-is-via-customizing/821/6 "2020-10-06T07:56:31Z")

</div>

That looks like a very sophisticated setup!  
I switch between my notes directory and test directory manually evaluating `(setq org-roam-directory ...)` etc. 😅  
Maybe time for adding a toggle function at least…
