diff options
-rw-r--r-- | short.nimble | 2 | ||||
-rw-r--r-- | src/short.nim | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/short.nimble b/short.nimble index 2834286..574c821 100644 --- a/short.nimble +++ b/short.nimble @@ -1,6 +1,6 @@ # Package -version = "0.2.0" +version = "0.3.0" author = "Julien Dessaux" description = "A simple, privacy friendly URL shortener" license = "EUPL-1.2" diff --git a/src/short.nim b/src/short.nim index 9ab5f97..791c96a 100644 --- a/src/short.nim +++ b/src/short.nim @@ -38,9 +38,6 @@ var db {.threadvar.}: DbConn proc initDB() {.raises: [SqliteError].} = if not db.isOpen(): db = openDatabase("data/short.db") - if not db.Migrate(): - echo "Failed to migrate database schema" - quit 1 func renderIndex(): string {.raises: [].} = var req: ShortUrl @@ -143,4 +140,9 @@ routes: resp code, htmlHeaders, content when isMainModule: + initDb() + if not db.Migrate(): + echo "Failed to migrate database schema" + quit 1 + db.close() runForever() |