mhamid3d
mhamid3d
Explore posts from servers
PPrisma
Created by mhamid3d on 4/13/2025 in #help-and-questions
Why do I have both `@prisma/client` and `generated/prisma/client` in my import suggestions?
Hello, first off the docs say: "The install command invokes prisma generate for you which reads your Prisma schema and generates a version of Prisma Client that is tailored to your models." This was not true for me, when I ran npm i @prisma/client, the prisma generate command was not run, I had to run it manually. Second when I try to import stuff from the client, I keep getting suggestions from both @prisma/client and my generated client, it's causing a lot of confusion. Is this normal and can I use them interchangebly?
5 replies
PPrisma
Created by mhamid3d on 4/4/2024 in #help-and-questions
Check constraint migration fails with syntax error
I made the following migration file and ran the migration:
ALTER TABLE "api_owner"
ADD CONSTRAINT "check_owner_one_null" CHECK (user_id IS NOT NULL AND organization_id IS NULL) OR (user_id IS NULL AND organization_id IS NOT NULL);

ALTER TABLE "api_entity"
ADD CONSTRAINT "check_non_self_parent" CHECK (parent_id <> id);
ALTER TABLE "api_owner"
ADD CONSTRAINT "check_owner_one_null" CHECK (user_id IS NOT NULL AND organization_id IS NULL) OR (user_id IS NULL AND organization_id IS NOT NULL);

ALTER TABLE "api_entity"
ADD CONSTRAINT "check_non_self_parent" CHECK (parent_id <> id);
And it results in this error:
Migration `20240404221624_check_constraints` failed to apply cleanly to the shadow database.
Error:
ERROR: syntax error at or near "OR"
0: sql_schema_connector::validate_migrations
with namespaces=None
at schema-engine\connectors\sql-schema-connector\src\lib.rs:324
1: schema_core::state::DevDiagnostic
at schema-engine\core\src\state.rs:267
Migration `20240404221624_check_constraints` failed to apply cleanly to the shadow database.
Error:
ERROR: syntax error at or near "OR"
0: sql_schema_connector::validate_migrations
with namespaces=None
at schema-engine\connectors\sql-schema-connector\src\lib.rs:324
1: schema_core::state::DevDiagnostic
at schema-engine\core\src\state.rs:267
2 replies