W
Wasp•3w ago
wbjb

@kapa.ai where in the open saas template is the section to add to the prisma schema

trying to add some fileds to my prisma schema in the open saas template. i can't find the file for the life of me.
2 Replies
kapa.ai
kapa.ai•3w ago
Hi @wbjb. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In the Open SaaS template, you don't directly edit a Prisma schema file. Instead, Wasp generates the Prisma schema based on the entities you define in the main.wasp file. This is a key feature of Wasp that simplifies database schema management. To add fields to your database schema, you need to modify or add entities in the main.wasp file. Here's how you can do it: 1. Open the main.wasp file in the root directory of your Open SaaS project. 2. Look for the entity definitions. They will look something like this:
entity User {=psl
id Int @id @default(autoincrement())
// Add your own fields below
// ...
psl=}
entity User {=psl
id Int @id @default(autoincrement())
// Add your own fields below
// ...
psl=}
3. Add your new fields within the {=psl psl=} tags of the relevant entity. After modifying the entities, you need to apply these changes to your database. Run the following command in your terminal:
wasp db migrate-dev
wasp db migrate-dev
This command will create a new database migration and apply it to your database, reflecting the changes you made to your entities. For more detailed information on working with entities in Wasp, you can refer to the Entities documentation (https://wasp-lang.dev/docs/data-model/entities). Remember, Wasp uses Prisma under the hood, but you don't interact with the Prisma schema directly. Instead, you define your data model using Wasp's entity syntax in the main.wasp file. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wbjb, 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?
miho
miho•3w ago
Have you looked in the app folder? It should be right at the top level and it's called prisma.schema 🙂

Did you find this page helpful?