From 1fd54b7aa0449bd16b484f289da7b5264161f967 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 8 Sep 2026 00:26:08 -0700 Subject: Move database initialization --- src/controller/routes.phel | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/controller/routes.phel') diff --git a/src/controller/routes.phel b/src/controller/routes.phel index 726f57b..b6335ca 100644 --- a/src/controller/routes.phel +++ b/src/controller/routes.phel @@ -5,12 +5,8 @@ (:require phel.router :as r) (:require phel.http :as h) (:require phel.pdo) - (:require phel.string :as str)) - -(def conn (pdo/connect "sqlite:test.db")) -(pdo/exec conn "create table if not exists books (id integer primary key autoincrement, title varchar(255), subtitle varchar(255))") -(pdo/exec conn "create table if not exists authors (id integer primary key autoincrement, name varchar(255))") -(pdo/exec conn "create table if not exists authors_books (author_id integer, book_id integer)") + (:require phel.string :as str) + (:require lezer.db :refer [conn])) (defn index-handler [req router] (let [books (for [b :in (pdo/select conn "select * from books")] -- cgit v1.3-2-g0d8e