import path from 'node:path';
import { defineConfig } from 'prisma/config';

export default defineConfig({
  earlyAccess: true,
  schema: path.join(__dirname, 'schema.prisma'),
  migrate: {
    async development() {
      // Use DATABASE_URL_DIRECT (bypasses PgBouncer) for migrations/introspection
      // when available; fall back to DATABASE_URL for local dev without PgBouncer.
      return {
        url: process.env.DATABASE_URL_DIRECT || process.env.DATABASE_URL!,
      };
    },
  },
});
