Last active
June 7, 2016 08:09
-
-
Save thirdknife/620261608eab24d17fcc064f48f801c3 to your computer and use it in GitHub Desktop.
fn.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns fs.core | |
(:require [clojure.java.jdbc :as sql])) | |
(let [db-protocol "file" | |
db-host "/Users/shakeel/Desktop" | |
db-name "fs"] | |
(def db {:classname "org.h2.Driver" ; must be in classpath | |
:subprotocol "h2" | |
:subname (str db-protocol "://" db-host "/" db-name) | |
:user "sa" | |
:password ""})) | |
(defn create-blogs | |
"Create a table to store blog entries" | |
[] | |
(sql/create-table-ddl | |
:blogs | |
([:id :int "PRIMARY KEY" "AUTO_INCREMENT"] | |
[:title "varchar(255)"] | |
[:body :text]))) | |
(sql/with-db-connection | |
[con-db db] | |
(sql/with-db-transaction | |
(create-blogs))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment