import * as dotenv from 'dotenv';
import * as path from 'path';
import { defineConfig } from 'prisma/config';

// Load .env.local first (higher priority), then .env
dotenv.config({ path: path.resolve(__dirname, '.env.local') });
dotenv.config({ path: path.resolve(__dirname, '.env') });

export default defineConfig({
  engine: 'classic',
  datasource: {
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
    url: process.env.DATABASE_URL!,
  },
  experimental: {
    externalTables: true,
  },
  tables: {
    // 将要被 Prisma 标记为“外部管理”的表名列表
    // 可以使用 "schema.table" 或仅 "table"（依你 DB/项目设置）
    external: ['public.users'],
  },
});
