From 14aea28ac22e5d2e9e510c5986daca1bef1c43ae Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Thu, 30 Jul 2020 20:03:19 +0200 Subject: Added some more user db functions --- src/db/DBController.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/db/DBController.ts') diff --git a/src/db/DBController.ts b/src/db/DBController.ts index cb714b3..0b212e7 100644 --- a/src/db/DBController.ts +++ b/src/db/DBController.ts @@ -1,5 +1,5 @@ import { Client } from "https://deno.land/x/mysql/mod.ts"; -import { readFileStr } from "https://deno.land/std/fs/mod.ts"; +import * as log from "https://deno.land/std/log/mod.ts"; export default class DBController { private client?: Client; @@ -7,13 +7,13 @@ export default class DBController { async init() { await this.connect(); try { - const sql = await readFileStr("./src/db/tables.sql"); + const sql = await Deno.readTextFile("./src/db/tables.sql"); const queries = sql.split(";"); queries.pop(); for (const query of queries) await this.execute(query); - console.log("Tables created"); + log.info("Tables created"); } catch (e) { - console.error("Could not create tables"); + log.error("Could not create tables"); throw e; } } @@ -28,7 +28,7 @@ export default class DBController { }); return this.client; } catch (e) { - console.error("Could not connect to database"); + log.error("Could not connect to database"); throw e; } } -- cgit v1.2.3