Prisma SQLServer Connection数据库为空



我正在尝试连接到我的SqlServer与Prisma。当我尝试"棱镜"时,"拉";我得到这个错误。

P4001 The introspected database was empty

当然我的数据库不是空的。这些是我的连接字符串(数据库,用户和密码为真)和schema.prisma;

.env:

DATABASE_URL="sqlserver://192.168.1.86;database=***_live_IT;user=***;password=***;encrypt=DANGER_PLAINTEXT;"

schema.prisma:

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlserver"
url      = env("DATABASE_URL")
}

这里是我的SqlServer表(我想连接***_live_IT)

数据库状态"置疑">

这里是该数据库的Tables

表状态"置疑">

任何想法都很感激。提前谢谢。

编辑:

PS D:xampphtdocsnoip> npx prisma db pull
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Prisma schema loaded from prismaschema.prisma
Environment variables loaded from .env
Datasource "db" - SQL Server
✖ Introspecting based on datasource defined in prismaschema.prisma
Error: 
P4001 The introspected database was empty:
prisma db pull could not create any models in your schema.prisma file and you will not be able to generate Prisma Client with the prisma generate command.
To fix this, you have two options:
- manually create a table in your database.
- make sure the database connection URL inside the datasource block in schema.prisma points to a database that is not empty (it must contain at least one table).
Then you can run prisma db pull again.

我用一个简单的方法解决了这个问题

prisma db push

然后

prisma db pull

添加"schema="当试图连接到本地sqlserver时,数据库url为我解决了这个问题。不幸的是,prisma一次只能连接到一个模式。

相关内容