Skip to content

Commit

Permalink
Fix exception in load-migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
weavejester committed Nov 8, 2024
1 parent 536e717 commit 5327371
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sql/src/ragtime/sql.clj
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
(->> (slurp f)
(edn/read-string)
(wrap-single-migration)
(map normalize-migration)
(compiler/compile)
(map normalize-migration)
(guess-id-from-file-extension f)))

(defmulti load-file-seq
Expand Down
3 changes: 2 additions & 1 deletion sql/test/migrations/008-test.edn
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[{:id "008-test" :up ["CREATE TABLE aaa (id int)"] :down ["DROP TABLE aaa"]}
{:id "009-test" :do [[:create-table bbb [id "int"]]]}]
{:id "009-test" :do [[:create-table bbb [id "int"]]]}
[:create-table ccc [id "int"]]]
12 changes: 9 additions & 3 deletions sql/test/ragtime/sql_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
{:id "008-test", :transactions :both
:up ["CREATE TABLE aaa (id int)"] :down ["DROP TABLE aaa"]}
{:id "009-test", :transactions :both
:up ["CREATE TABLE bbb (id int)"] :down ["DROP TABLE bbb"]}]
:up ["CREATE TABLE bbb (id int)"] :down ["DROP TABLE bbb"]}
{:id "create-table-ccc", :transactions :both
:up ["CREATE TABLE ccc (id int)"] :down ["DROP TABLE ccc"]}]
(sql/load-directory "test/migrations"))))

(deftest test-load-resources
Expand All @@ -53,12 +55,16 @@
{:id "008-test", :transactions :both
:up ["CREATE TABLE aaa (id int)"] :down ["DROP TABLE aaa"]}
{:id "009-test", :transactions :both
:up ["CREATE TABLE bbb (id int)"] :down ["DROP TABLE bbb"]}]
:up ["CREATE TABLE bbb (id int)"] :down ["DROP TABLE bbb"]}
{:id "create-table-ccc", :transactions :both
:up ["CREATE TABLE ccc (id int)"] :down ["DROP TABLE ccc"]}]
(sql/load-resources "migrations"))))

(deftest test-load-migrations
(is (= [{:id "008-test", :transactions :both
:up ["CREATE TABLE aaa (id int)"] :down ["DROP TABLE aaa"]}
{:id "009-test", :transactions :both
:up ["CREATE TABLE bbb (id int)"] :down ["DROP TABLE bbb"]}]
:up ["CREATE TABLE bbb (id int)"] :down ["DROP TABLE bbb"]}
{:id "create-table-ccc", :transactions :both
:up ["CREATE TABLE ccc (id int)"] :down ["DROP TABLE ccc"]}]
(sql/load-migrations "test/migrations/008-test.edn"))))

0 comments on commit 5327371

Please sign in to comment.