style tweaks #8
|
@ -1,5 +1,4 @@
|
||||||
import pg from 'pg';
|
import pg from 'pg';
|
||||||
import { getConnection } from './database/get_connection';
|
|
||||||
|
|
||||||
export class Postgres {
|
export class Postgres {
|
||||||
client: pg.PoolClient | null = null;
|
client: pg.PoolClient | null = null;
|
||||||
|
@ -33,7 +32,3 @@ export class Postgres {
|
||||||
export default async (
|
export default async (
|
||||||
pool: pg.Pool
|
pool: pg.Pool
|
||||||
) => { return await Postgres.new(pool); };
|
) => { return await Postgres.new(pool); };
|
||||||
|
|
||||||
import { building } from '$app/environment';
|
|
||||||
import init from '$lib/server/database/init_db';
|
|
||||||
if (!building) await init(await Postgres.new(getConnection()));
|
|
||||||
|
|
|
@ -13,3 +13,7 @@ const connectionString = `postgres://${PG_USER}:${PG_PASS}@${PG_HOST}:${PG_PORT}
|
||||||
const pool = new Pool({ connectionString });
|
const pool = new Pool({ connectionString });
|
||||||
|
|
||||||
export const getConnection = () => pool;
|
export const getConnection = () => pool;
|
||||||
|
|
||||||
|
import init from '$lib/server/database/init_db';
|
||||||
|
import PG from '$lib/server/database';
|
||||||
|
await init(await PG(pool));
|
Loading…
Reference in New Issue
Block a user