aboutsummaryrefslogtreecommitdiff
path: root/src/guff/model.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff/model.cr')
-rw-r--r--src/guff/model.cr12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/guff/model.cr b/src/guff/model.cr
index 0bc0e78..1df437b 100644
--- a/src/guff/model.cr
+++ b/src/guff/model.cr
@@ -1,3 +1,6 @@
+require "./database"
+require "./database-updater"
+
module Guff
class Model
getter :config
@@ -6,7 +9,16 @@ module Guff
def initialize(@config : Config)
# create site database
db_path = "%s/site.db" % [config["data"]]
+
+ # update database (if necessary)
+ update_db(db_path)
+
+ # open db
@db = Database.new(db_path)
end
+
+ private def update_db(path)
+ DatabaseUpdater.run(path, @config)
+ end
end
end