-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In the code, it uses some stuff to get the database name path from the dotenv using a line like this:
mito:connect-toplevel
:sqlite3
:database-name (uiop:native-namestring (uiop:parse-unix-namestring (uiop:getenv "SQLITE_DB_NAME"))))
In my .env I was following the proposed example ~/common-lisp/ningle-tutorial-project/ntp.db
I verified the root of the path exists. When I run the migraiton, it fails to open the ntp.db. It appears that on OS X, ~ (tilde) doesn't get expanded properly, and remains ~, and whatever lisp I use doesn't do the right thing with it. If I change the path to ntp.db to be absolute, it works fine.
What is the advantage of the uiop:native-namestring in this case. Is #P" not portable ? Should we just use (uiop:getenv "HOME") to get the homedir in the example? Took awhile to figure out what was going on. Since sqlite is a bit of an exceptional case compared to the other DBs, perhaps it is worth noting in the example on Blog Week 6.
From:
https://github.com/fukamachi/mito/?tab=readme-ov-file#connecting-to-db
(let ((mito:*connection* (dbi:connect :sqlite3 :database-name #P"/tmp/myapp.db")))
(unwind-protect (progn ...)
;; Ensure that the connection is closed.
(dbi:disconnect mito:*connection*)))