aboutsummaryrefslogtreecommitdiff
path: root/src/db/DBController.ts
diff options
context:
space:
mode:
authorLarsVomMars2020-07-30 20:03:19 +0200
committerLarsVomMars2020-07-30 20:03:19 +0200
commit14aea28ac22e5d2e9e510c5986daca1bef1c43ae (patch)
tree7d117c9aacd2fff312f4df39373d5bc57c3b58be /src/db/DBController.ts
parentf5f651d5180ddd12c57288d534129c8b00ff3162 (diff)
Added some more user db functions
Diffstat (limited to 'src/db/DBController.ts')
-rw-r--r--src/db/DBController.ts10
1 files changed, 5 insertions, 5 deletions
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;
}
}