Olyno
Explore posts from serversPPrisma
•Created by Nicklas Smit on 6/27/2024 in #help-and-questions
Nested queries with mongodb not working.
Hi :vmathi: You already bumped your message a few minutes ago, it is not necessary to ping mods for that 🙂
11 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
It should throw an error
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
It should be handled, but you can give it a try to be sure
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
This is mainly something goes wrong, they act as safeguard
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Wrapping the update in a transaction can ensure that all operations within the transaction scope either complete successfully or roll back together, which is crucial for maintaining database consistency, especially if the update operation depends on multiple steps or includes additional related changes.
Using a transaction ensures atomicity. If any part of the update process fails, the transaction will roll back, leaving the database in a consistent state. This is especially useful if there are multiple dependent operations or if future modifications might require additional steps within the update process.
16 replies
PPrisma
•Created by kgtrey1 on 7/3/2024 in #help-and-questions
how to import prisma client on a client without compromising credentials
Don't you have the
Status
enum available in exports from the client?10 replies
PPrisma
•Created by kgtrey1 on 7/3/2024 in #help-and-questions
how to import prisma client on a client without compromising credentials
Or import it from prisma
10 replies
PPrisma
•Created by kgtrey1 on 7/3/2024 in #help-and-questions
how to import prisma client on a client without compromising credentials
My guess would be to recreate this enum based on the type
10 replies
PPrisma
•Created by kgtrey1 on 7/3/2024 in #help-and-questions
how to import prisma client on a client without compromising credentials
When you generate the Prisma client, you also generate types. Simply import those types:
I forgot how types are generated from the client 😅
10 replies
PPrisma
•Created by erich_fromm on 7/2/2024 in #help-and-questions
What’s a good strategy for migration if downtime is not a problem?
Hi :vmathi: Your strategy sounds solid for a migration with allowed downtime
2 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Hi :vmathi: Tt is necessary to verify that the two records comprising its composite ID exist before updating the bridge table. This is to ensure data integrity and to avoid potential errors during the update process.
You can do it using something like that:
16 replies
PPrisma
•Created by kgtrey1 on 7/3/2024 in #help-and-questions
how to import prisma client on a client without compromising credentials
Hi :vmathi: You an import Prisma types safely, those are only Typescript types. You just won't import the prisma client at any cost in your client or it will be compromised
10 replies
PPrisma
•Created by ddm4313 on 7/3/2024 in #help-and-questions
Random garbage errors
I could help you more if you share a little bit more of your code, like your schema and the code you are using 😅
12 replies
PPrisma
•Created by Nawwa on 7/3/2024 in #help-and-questions
How can I use plain object instead of composite types ?
Hi :vmathi: Sorry to hear that! You can try to upgrade to a fixed version,
v4.16.2-dev.2
, which should fix some issues with composites:
Another option is to try to have explicit type selection by explicitly select the fields you need in your queries:
You can also use Prisma's $extends
feature to create custom extensions that simplify access to your nested fields, allowing you to define getter methods to access fields directly without navigating through scalars
:
The latest option i would suggest would be to downgrade to v4.15.0
if none of the options above work5 replies
PPrisma
•Created by ddm4313 on 7/3/2024 in #help-and-questions
Random garbage errors
Prisma supports any level of nesting supported by the data model
12 replies
PPrisma
•Created by ddm4313 on 7/3/2024 in #help-and-questions
Random garbage errors
Hi :vmathi: Sorry to hear that. It could be caused by a wrong schema relation. Can you have a look into this?
12 replies
PPrisma
•Created by Samtuga1 on 5/3/2024 in #help-and-questions
How to run safe migrations
Hi :vmathi: First create a new migration:
Then add your migration to the new created file.
If you want to set a default value for the new field for existing records, you can add an
UPDATE
SQL command before the ALTER TABLE
command that adds the new field. For example, if you're adding a businessId
field to the hairstyle
table and want to set a default value of NULL
for existing records, you could add:
If you want to remove records that do not have corresponding references, you can add a DELETE
SQL command. For example:
Whenever you're ready, run your new migration:
4 replies
PPrisma
•Created by Juan Gouveia on 5/3/2024 in #help-and-questions
Prisma Warn Console in development
Hi :vmathi: Have you tried to simply run
prisma generate --no-engine
as suggested?5 replies
PPrisma
•Created by snchmt on 4/15/2024 in #help-and-questions
How to cascade delete properly in a self-relation with mongodb ?
Well, if you're using Mongo, it should be an object. If you delete the parent object, it should delete everything
23 replies
PPrisma
•Created by tzezar on 4/30/2024 in #help-and-questions
MTI key relation
Hi :vmathi: This looks correct to me. Did you get any issue with it?
5 replies