diff of fc3553f3d054eb592b1de685cb49ffb8ac64ece8
fc3553f3d054eb592b1de685cb49ffb8ac64ece8
diff --git a/src/local-lib/halisql.lisp b/src/local-lib/halisql.lisp
index e11eb76..81af1b0 100644
--- a/src/local-lib/halisql.lisp
+++ b/src/local-lib/halisql.lisp
@@ -1,7 +1,7 @@
(defpackage halisql
(:use :cl :binding-arrows)
(:import-from :lisp-fixup :slurp-utf-8 :drop :partial :compose)
- (:export :get-sql :*log* :pick-queries :defqueries :*system-name*))
+ (:export :slurp-sql :get-sql :*log* :pick-queries :defqueries :*system-name*))
(in-package :halisql)
diff --git a/src/local-lib/migrations.lisp b/src/local-lib/migrations.lisp
index 88962be..261e9cd 100644
--- a/src/local-lib/migrations.lisp
+++ b/src/local-lib/migrations.lisp
@@ -20,21 +20,17 @@
(defun defmigration (path &key initial)
- (let* ((queries (pick-queries path))
+ (let* ((filename (asdf:system-relative-pathname *system-name*
+ (format nil "resources/sql/~a.sql" path)))
;; ragtime legacy, migration filenames are named .up.sql but they were saved into the public.ragtime_migrations without the .up.sql postfix
;; and murja.migrations/halisql system drops the .sql extension, but halisql functions don't handle the .up. string correctly
(path (str:replace-all ".up" "" path))
- (sql-statements (mapcar #'get-sql queries))
- (a-loop (lambda ()
- (dolist (sql sql-statements)
- (postmodern:execute sql))
- (mark-migration-done path)))
(fn (lambda ()
(cond ((and initial (not (migration-table-exists)))
- (funcall a-loop))
+ (postmodern:execute-file filename))
((and (migration-table-exists) (not (migration-does-exist path)))
- (funcall a-loop))
+ (postmodern:execute-file filename))
(t (log:info "Didn't run ~a" path)))))
(found-migration? nil))