Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: The prefix db is invalid #1708

Open
tonxxd opened this issue Sep 17, 2024 · 0 comments
Open

error: The prefix db is invalid #1708

tonxxd opened this issue Sep 17, 2024 · 0 comments

Comments

@tonxxd
Copy link

tonxxd commented Sep 17, 2024

Description and expected behavior
Hi, i have a model in the schema that looks like

model alembic_version {
  version_num String @id(map: "alembic_version_pkc") @db.VarChar(32)
}

This throws an error when running zenstack generate

Error: Prisma schema validation - (get-dmmf wasm)
Error code: P1012
error: The prefix db is invalid. It must be equal to the name of an existing datasource e.g. postgresql. Did you mean to use postgresql.VarChar?
  -->  schema.prisma:298
   |
297 | model alembic_version {
298 |     version_num String @id(map: "alembic_version_pkc") @db.VarChar(32)
   |

Validation Error Count: 1
[Context: getDmmf]

If i change to

model alembic_version {
  version_num String @id(map: "alembic_version_pkc") @postgresql.VarChar(32)
}

Then in vscode i get Could not resolve reference to Attribute named '@postgresql.VarChar'.zmodel(linking-error)
and when trying to generate i get

Validation errors:
line 330: Could not resolve reference to Attribute named '@postgresql.VarChar'. [@postgresql.VarChar]
error Command failed with exit code 1.

The second option should be the right one since is what prisma expects (it's generated by prisma db pull)

Any ideas?

Environment (please complete the following information):

  • "zenstack": "1.12.3"
  • "prisma": "^5.12.1",
  • Database type: Postgresql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant