From df8dbe48e73581599f73c365e173fb017f0919c3 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 5 Mar 2016 19:01:25 -0500 Subject: refactor model and db --- src/guff/database.cr | 7 +++++++ src/guff/model.cr | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/guff/database.cr create mode 100644 src/guff/model.cr (limited to 'src/guff') diff --git a/src/guff/database.cr b/src/guff/database.cr new file mode 100644 index 0000000..de11eb2 --- /dev/null +++ b/src/guff/database.cr @@ -0,0 +1,7 @@ +require "sqlite3" + +module Guff + class Database < ::SQLite3::Database + # TODO (add table_exists?) + end +end diff --git a/src/guff/model.cr b/src/guff/model.cr new file mode 100644 index 0000000..370229c --- /dev/null +++ b/src/guff/model.cr @@ -0,0 +1,11 @@ +module Guff + class Model + getter :db + + def initialize(@config : Config) + # create site database + db_path = "%s/site.db" % [config["data"]] + @db = Database.new(db_path) + end + end +end -- cgit v1.2.3