我正在尝试为 FastAPI 项目实现 Prisma。我添加了 Prisma 包和
schema.prisma
文件,但是当我运行 prisma validate
时它会抛出错误:
Environment variables loaded from prisma\.env
Prisma schema loaded from prisma\schema.prisma
Error: Prisma schema validation - (validate wasm)
Error code: P1012
error: Error validating: This line is invalid. It does not start with any known Prisma schema keyword.
--> prisma\schema.prisma:1
|
|
1 | datasource db {
2 | url = env("DATABASE_URL")
|
error: Error validating: This line is invalid. It does not start with any known Prisma schema keyword.
--> prisma\schema.prisma:2
|
1 | datasource db {
2 | url = env("DATABASE_URL")
3 | provider = "postgresql"
|
error: Error validating: This line is invalid. It does not start with any known Prisma schema keyword.
--> prisma\schema.prisma:3
|
2 | url = env("DATABASE_URL")
3 | provider = "postgresql"
4 | }
|
error: Error validating: This line is invalid. It does not start with any known Prisma schema keyword.
--> prisma\schema.prisma:4
|
3 | provider = "postgresql"
4 | }
5 |
|
但我不明白为什么。这是我的架构:
datasource db {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-py"
recursive_type_depth = 5
}
model User {
id Int @id @default(autoincrement())
email String @unique
username String @db.VarChar(12)
name String @db.VarChar(25)
lastname String @db.VarChar(25)
password String @db.VarChar(20)
}
我开始学习 prisma 所以我不知道我是否做错了什么。