diff options
| author | 2026-09-08 00:26:08 -0700 | |
|---|---|---|
| committer | 2026-09-08 00:26:08 -0700 | |
| commit | 1fd54b7aa0449bd16b484f289da7b5264161f967 (patch) | |
| tree | b948eaeaf97275820f220b55a43ed3fe8a2e6f2a /src/controller | |
| parent | 94ef10d1fe4ed27f8442944c25ecc0300c5e5655 (diff) | |
| download | lezer-1fd54b7aa0449bd16b484f289da7b5264161f967.tar.gz lezer-1fd54b7aa0449bd16b484f289da7b5264161f967.zip | |
Move database initialization
Diffstat (limited to 'src/controller')
| -rw-r--r-- | src/controller/routes.phel | 8 |
1 files changed, 2 insertions, 6 deletions
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")] |
