From 3b70a1a497b0c2cb1ee17710aa92db4c2643c934 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Wed, 27 Mar 2024 16:16:49 +0200 Subject: [PATCH] Add a function to create tables. --- src/main/blog/db.cljs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/blog/db.cljs b/src/main/blog/db.cljs index c99f533..3d6b0ce 100644 --- a/src/main/blog/db.cljs +++ b/src/main/blog/db.cljs @@ -14,3 +14,7 @@ [client] (. client connect)) +(defn create-tables + [client] + (. client query "CREATE TABLE IF NOT EXISTS articles (id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, created TIMESTAMP DEFAULT CURRENT_TIMESTAMP);")) +