aboutsummaryrefslogtreecommitdiff
path: root/cljssss-g.clj
diff options
context:
space:
mode:
Diffstat (limited to 'cljssss-g.clj')
-rw-r--r--cljssss-g.clj62
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"])))