import { config } from "dotenv";
import { drizzle } from "drizzle-orm/node-postgres";
import { resolve } from "path";
import { fileURLToPath } from "url";
import { dirname } from "path";
import * as schema from "./db/schema.js";

config({
  path: resolve(dirname(fileURLToPath(import.meta.url)), "../../../../.env"),
});

export const db = drizzle(
  process.env["DATABASE_URL_LOCAL"] ?? process.env["DATABASE_URL"]!,
  { schema },
);

export * from "./models/termModel.js";
export * from "./models/lobbyModel.js";
