diff --git a/src/index.ts b/src/index.ts index c8242b0..9e817f9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,20 +1,3 @@ -import postgres from "postgres"; -import { drizzle } from "drizzle-orm/postgres-js"; -import { cosmetics, players } from "./schema"; - -/** - * @param connectionString See {@link https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS Postgres Connection URIs} - */ -export default function initializeDatabase({ - connectionUri, -}: { - connectionUri: string; -}) { - const client = postgres(connectionUri, { prepare: false }); - const db = drizzle(client, { schema: { cosmetics, players } }); - - return { client, db }; -} - -export * from "./types"; -export * from "./schema"; +export * from "./lib/database"; +export * from "./lib/types"; +export * from "./lib/schema"; diff --git a/src/lib/database.ts b/src/lib/database.ts new file mode 100644 index 0000000..d68385c --- /dev/null +++ b/src/lib/database.ts @@ -0,0 +1,17 @@ +import postgres from "postgres"; +import { drizzle } from "drizzle-orm/postgres-js"; +import { cosmetics, players } from "./schema"; + +/** + * @param connectionString See {@link https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS Postgres Connection URIs} + */ +export default function initializeDatabase({ + connectionUri, +}: { + connectionUri: string; +}) { + const client = postgres(connectionUri, { prepare: false }); + const db = drizzle(client, { schema: { cosmetics, players } }); + + return { client, db }; +} diff --git a/src/schema.ts b/src/lib/schema.ts similarity index 100% rename from src/schema.ts rename to src/lib/schema.ts diff --git a/src/types.ts b/src/lib/types.ts similarity index 100% rename from src/types.ts rename to src/lib/types.ts