diff --git a/db/initialize.ts b/db/initialize.ts index eb1fe3f..8f0f645 100644 --- a/db/initialize.ts +++ b/db/initialize.ts @@ -1,21 +1,8 @@ // This file will create all tables for the artificer schema // DATA WILL BE LOST IF DB ALREADY EXISTS, RUN AT OWN RISK -import { - // MySQL deps - Client -} from "../deps.ts"; - -import { LOCALMODE } from "../flags.ts"; import config from "../config.ts"; - -// Log into the MySQL DB -const dbClient = await new Client().connect({ - hostname: LOCALMODE ? config.db.localhost : config.db.host, - port: config.db.port, - username: config.db.username, - password: config.db.password, -}); +import { dbClient } from "../src/db.ts"; console.log("Attempting to create DB"); await dbClient.execute(`CREATE SCHEMA IF NOT EXISTS ${config.db.name};`); diff --git a/db/populateDefaults.ts b/db/populateDefaults.ts index 9500d40..84956b4 100644 --- a/db/populateDefaults.ts +++ b/db/populateDefaults.ts @@ -1,21 +1,7 @@ // This file will populate the tables with default values -import { - // MySQL deps - Client -} from "../deps.ts"; - -import { LOCALMODE } from "../flags.ts"; import config from "../config.ts"; - -// Log into the MySQL DB -const dbClient = await new Client().connect({ - hostname: LOCALMODE ? config.db.localhost : config.db.host, - port: config.db.port, - db: config.db.name, - username: config.db.username, - password: config.db.password, -}); +import { dbClient } from "../src/db.ts"; console.log("Attempting to populate DB Admin API key"); await dbClient.execute("INSERT INTO all_keys(userid,apiKey) values(?,?)", [config.api.admin, config.api.adminKey]).catch(e => { diff --git a/src/commands/roll/_rollIndex.ts b/src/commands/roll/_rollIndex.ts index efd6fdc..ac6686d 100644 --- a/src/commands/roll/_rollIndex.ts +++ b/src/commands/roll/_rollIndex.ts @@ -2,4 +2,4 @@ import { getModifiers } from "./getModifiers.ts"; export default { getModifiers -}; \ No newline at end of file +};