W
Wasp8mo ago
JLegendz

New Wasp Entity Attributes Not included in CreateEntityName function

I have an Entity that I've added new attributes to. I've done this several times without any issues. But now, I've added a few attributes and i've run the command to refresh the db. But when I attempt to use the createEntityName function elsewhere, my new attributes aren't allowed as arguments.
9 Replies
MEE6
MEE68mo ago
Wohooo @JLegendz, you just became a Waspeteer level 2!
kapa.ai
kapa.ai8mo ago
Hi @JLegendz. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It seems like you're having trouble with the createEntityName function not recognizing the new attributes you've added to your entity. This could be due to a few reasons: 1. Database Migration: After adding new attributes to an entity, you need to run a database migration to update the database schema. This can be done using the wasp db migrate-dev command. If you've already done this, ensure that the migration was successful and didn't throw any errors. If there were errors, they need to be resolved before the new attributes can be recognized. source (https://wasp-lang.dev/docs/tutorial/entities) 2. Entity Definition: Ensure that the new attributes have been correctly defined in the entity in your Wasp file. The entity definition should be in the Prisma Schema Language (PSL) format. source (https://wasp-lang.dev/docs/tutorial/entities) 3. Function Override: If you're using a custom implementation for the create operation (like createEntityName), ensure that the new attributes have been included in the function definition. If you've overridden the create operation with a custom function, the function needs to be updated to include the new attributes. source (https://wasp-lang.dev/docs/data-model/crud#adding-crud-to-the-task-entity-) If you've checked all of these and are still having issues, it might be a good idea to ask for help on the Wasp Discord or GitHub. There might be a specific issue with your code that needs to be looked at. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @JLegendz, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
JLegendz
JLegendzOP8mo ago
Here is an example: This is my createAdvertisment function being called, showing what arguments it expects.
No description
JLegendz
JLegendzOP8mo ago
And these are all the attributes I expect to see in that list:
No description
JLegendz
JLegendzOP8mo ago
As a result, I'm unable to add these extra arguments to my createAdvertisement function:
No description
JLegendz
JLegendzOP7mo ago
I was able to fix it by just swapping the order of the attributes in my entity. That triggered the db to notice the changes and allow me to add the extra attributes. :wasplang:
miho
miho7mo ago
Did you add showDays[]? in the same go? Because this is not allowed in Prisma: https://www.prisma.io/docs/orm/prisma-schema/data-model/models#type-modifiers Optional lists are not supported. This may cause weird Prisma issues which Wasp might not recognize properly right now. You should remove the ? after the ShowDays[]
Models | Prisma Documentation
Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.
martinsos
martinsos7mo ago
Yeah this is most likely it, Waps fails silently on it unfortunately, but we will be fixing that soon (we are working on this and some other prisma improvements at the very moment).
Want results from more Discord servers?
Add your server