import { PrismaClient } from "../generated/prisma/client";
import { PrismaMariaDb } from "@prisma/adapter-mariadb";

const dbConfig = {
  host: process.env.DB_HOST!,
  user: process.env.DB_USER!,
  password: process.env.DB_PASSWD!,
  database: process.env.DB_NAME!,
  port: Number(process.env.DB_PORT!),
};
console.debug('init prisma client...', dbConfig);

const adapter = new PrismaMariaDb(dbConfig);

export const prisma = new PrismaClient({ adapter });