diff options
Diffstat (limited to 'web/panettone')
-rw-r--r-- | web/panettone/default.nix | 3 | ||||
-rw-r--r-- | web/panettone/src/model.lisp | 3 | ||||
-rw-r--r-- | web/panettone/src/util.lisp | 7 |
3 files changed, 8 insertions, 5 deletions
diff --git a/web/panettone/default.nix b/web/panettone/default.nix index 91ac34ea5482..60fca99e7544 100644 --- a/web/panettone/default.nix +++ b/web/panettone/default.nix @@ -27,10 +27,11 @@ depot.nix.buildLisp.program { (pkgs.writeText "build.lisp" '' (defpackage build (:use :cl :alexandria) - (:export :*migrations-dir*)) + (:export :*migrations-dir* :*static-dir*)) (in-package :build) (declaim (optimize (safety 3))) (defvar *migrations-dir* "${./src/migrations}") + (defvar *static-dir* "${./src/static}") '') ./src/util.lisp ./src/css.lisp diff --git a/web/panettone/src/model.lisp b/web/panettone/src/model.lisp index 5dff14818ebe..15fe4815be1a 100644 --- a/web/panettone/src/model.lisp +++ b/web/panettone/src/model.lisp @@ -324,6 +324,7 @@ in the context of a database transaction and should perform the migration." (defun migrate () "Migrate the database, running all migrations that have not yet been run" (ensure-migrations-table) + (format t "Running migrations from ~A...~%" *migrations-dir*) (let* ((all-migrations (load-migrations)) (already-run (migrations-already-run)) (num-migrations-run 0)) @@ -350,7 +351,7 @@ in the context of a database transaction and should perform the migration." ;; otherwise, run the migration (run-migration migration)) (incf num-migrations-run)) - (format nil "Ran ~A migration~:P" num-migrations-run))) + (format t "Ran ~A migration~:P~%" num-migrations-run))) ;;; ;;; Querying diff --git a/web/panettone/src/util.lisp b/web/panettone/src/util.lisp index c9d86cbfb32d..4c3c4f1aa692 100644 --- a/web/panettone/src/util.lisp +++ b/web/panettone/src/util.lisp @@ -16,8 +16,9 @@ that it can be successfully decoded by the `BASE64' package" (defun and-where (clauses) "Combine all non-nil clauses in CLAUSES into a single S-SQL WHERE form" - (if (null clauses) t - (reduce (lambda (x y) `(:and ,x ,y)) clauses))) + (let ((clauses (remove nil clauses))) + (if (null clauses) t + (reduce (lambda (x y) `(:and ,x ,y)) clauses)))) (defun and-where* (&rest clauses) "Combine all non-nil clauses in CLAUSES into a single S-SQL WHERE form" @@ -27,7 +28,7 @@ that it can be successfully decoded by the `BASE64' package" (name value-if-not-in-build &optional (doc nil)) `(defvar ,name (or (when-let ((package (find-package :build))) - (let ((sym (find-symbol ,(symbol-name name)))) + (let ((sym (find-symbol ,(symbol-name name) package))) (when (boundp sym) (symbol-value sym)))) ,value-if-not-in-build) ,doc)) |