From 394e2f9b517d9eb1342a4558ff38a666f51160c2 Mon Sep 17 00:00:00 2001 From: Luciano Laratelli Date: Fri, 11 Apr 2025 13:52:56 -0400 Subject: [PATCH] ok... --- Dockerfile | 2 +- resources/migrations/init.sql | 2 +- src/com/score_the_pigs.clj | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 291c7de..d9e108c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN clojure -T:build uberjar FROM eclipse-temurin:21-alpine -RUN apk add --no-cache libstdc++ sqlite +RUN apk add --no-cache libstdc++ curl sqlite RUN addgroup -S atlantico-software && \ adduser -S atlantico-software -G atlantico-software diff --git a/resources/migrations/init.sql b/resources/migrations/init.sql index b30ee49..e0ac49d 100644 --- a/resources/migrations/init.sql +++ b/resources/migrations/init.sql @@ -1 +1 @@ -PRAGMA journal_mode=WAL; +SELECT 1; diff --git a/src/com/score_the_pigs.clj b/src/com/score_the_pigs.clj index c9ccde0..10f3ef0 100644 --- a/src/com/score_the_pigs.clj +++ b/src/com/score_the_pigs.clj @@ -1,5 +1,7 @@ (ns com.score-the-pigs (:require + [babashka.process :as process] + [clojure.string :as str] [clojure.test :as test] [com.biffweb :as biff] [com.score-the-pigs.app :as app] @@ -59,7 +61,12 @@ (defn use-sqlite [ctx] (let [db-url (get ctx :example/db-url) ds (jdbc/get-datasource db-url) - migration-config (ctx->migratus-config ctx)] + migration-config (ctx->migratus-config ctx) + db-loc (-> db-url + (str/split #":") + last)] + + (process/shell (str "sqlite3" db-loc "'PRAGMA journal_mode=WAL;'")) (migratus/init migration-config) (migratus/migrate migration-config)