fix: prisma url in schema + first user becomes ADMIN

- Add url = env("DATABASE_URL") back to schema (required by Prisma 7.5)
- Simplify prisma.config.ts
- First registered user auto-promoted to ADMIN via databaseHooks
- Subsequent users get HOST role
This commit is contained in:
2026-03-24 03:54:55 +03:00
parent e59ba0ab97
commit a6c744223b
4 changed files with 27 additions and 8 deletions

View File

@@ -173,8 +173,8 @@ DEV_ACCESS_KEY=mySecretKey123
## Prisma 7 Notes
- `prisma.config.ts` in project root (required by Prisma 7)
- `datasourceUrl` passed via PrismaClient constructor, not in schema
- Schema has no `url` in datasource block — only `provider`
- `url = env("DATABASE_URL")` in schema datasource — standard approach, works with CLI and PrismaClient
- `new PrismaClient()` without arguments — URL resolved from schema's `env("DATABASE_URL")`
- Use `-- --webpack` flag for `next build` on Windows (Turbopack WASM issue)
## Auth Notes