From d45a40551115119c2fc5cb0c33b7977aa14da5fd Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Wed, 25 Oct 2023 15:00:13 +0200 Subject: [PATCH] ... --- lib/db/db.ts | 17 ++++++++--------- scripts/setup-database.ts | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/db/db.ts b/lib/db/db.ts index 38686581..952adcdd 100644 --- a/lib/db/db.ts +++ b/lib/db/db.ts @@ -1,8 +1,8 @@ import { Kysely, MysqlDialect } from 'kysely'; import { type ColumnType, type Generated } from 'kysely'; +import { createPool } from 'mysql2'; import type { GameRecord, XWSFaction, XWSSquad } from '@/lib/types'; -import { createPool } from 'mysql2'; // Types // --------------- @@ -45,15 +45,14 @@ export interface Database { // --------------- export const db = new Kysely({ dialect: new MysqlDialect({ - pool: async () => - createPool({ - host: process.env.DATABASE_HOST, - user: process.env.DATABASE_USERNAME, - password: process.env.DATABASE_PASSWORD, - database: 'main', - }), + pool: createPool({ + host: process.env.DATABASE_HOST, + user: process.env.DATABASE_USERNAME, + password: process.env.DATABASE_PASSWORD, + database: 'main', + }), }), - // log: ['query'], + // log: ['query', 'error'], }); export const initDatabase = async () => diff --git a/scripts/setup-database.ts b/scripts/setup-database.ts index 5029e995..d93e2c96 100644 --- a/scripts/setup-database.ts +++ b/scripts/setup-database.ts @@ -95,5 +95,4 @@ void (async () => { } catch (err: any) { console.log(chalk.red.bold(err?.body?.message || err.message || err)); } - process.exit(0); // Weird 🤷‍♂️ })();