mirror of
https://github.com/Burn-E99/TheArtificer.git
synced 2026-06-04 09:03:50 -04:00
Use new dbClient import in the db init files
This commit is contained in:
@@ -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};`);
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user