diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2009-02-19 13:07:54 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2009-02-19 13:07:54 +0100 |
commit | 03a8ef22aa54073ba1b59252e594b8f37f90bc7e (patch) | |
tree | ba090f1243f01b5294ec09d32b18f48053d4779f | |
parent | a35b9044a5bf26152f30bc4abe981bb7dd985e7b (diff) |
Add database schema.
-rw-r--r-- | cljssss-g.clj | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/cljssss-g.clj b/cljssss-g.clj index c99a0df..074e6ab 100644 --- a/cljssss-g.clj +++ b/cljssss-g.clj @@ -21,9 +21,69 @@ (defmacro with-db [& body] `(sql/with-connection {:classname "org.sqlite.JDBC" :subprotocol "sqlite" - :subname "cljssss-g.sqlite3"} + :subname "cljssss-g.sqlite3" + :create true} (sql/transaction ~@body))) (run-server {:port 8080} "/*" cljssss-g) + + +;;;; Database schema +(comment + (with-db + (sql/create-table :user + [:id "integer" "PRIMARY KEY"] + [:name "text"] + [:email "text"] + [:password "text"])) + + (with-db + (sql/create-table :feed + [:id "integer" "PRIMARY KEY"] + [:uri "text"] + [:language "text"] + [:iri "text"] + [:icon "blob"] + [:link "text"] + [:logo "text"] + [:rights "text"] + [:title "text"] + [:subtitle "text"] + [:updated "date"])) + + (with-db + (sql/create-table :entry + [:id "integer" "PRIMARY KEY"] + [:uri "text"] + [:language "text"] + [:content "blob"] + [:content_type "text"] + [:iri "text"] + [:link "text"] + [:published "date"] + [:rights "text"] + [:source "integer"] ;:feed + [:title "text"] + [:summary "text"] + [:updated "date"])) + + (with-db + (sql/create-table :feed_entry_link + [:feed "integer"] + [:entry "integer"])) + + (with-db + (sql/create-table :user_feed_link ;subscription + [:user "integer"] + [:feed "integer"] + [:title "text"])) + + (with-db + (sql/create-table :user_entry_link + [:user "integer"] + [:entry "integer"] + [:read "boolean"] + [:marked "boolean"] + [:hidden "boolean"]))) |