Multi-file Prisma
I would like to implement multi-file prisma. In a nutshell, instead of having all your models in 1 file, you can split it up.
I was wondering how I could implement it in my wasp.
Here is the official documentation:
https://www.prisma.io/docs/orm/prisma-schema/overview/location
Prisma Schema Location and Configuration | Prisma Documentation
Documentation regarding proper location of Prisma Schema including default naming and multiple files.
4 Replies
Hi @Alex | ClipStake. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Currently, Wasp doesn't support splitting your Prisma schema into multiple files. In Wasp, entities are defined directly in the
main.wasp
file using Prisma Schema Language (PSL), and there's no built-in way to modularize these definitions across multiple files yet.
The Wasp team is aware that the main.wasp
file can grow quite large as applications become more complex. They're actively working on implementing modular .wasp
files in future releases. This feature is planned and has been discussed in several places:
1. There's an open GitHub issue specifically for supporting splitting Wasp source code into multiple files: Support splitting Wasp source code into multiple files
2. The Wasp team has confirmed in Discord discussions that modular .wasp
files are coming soon:
- "This is coming soon! In the next release perhaps."
- "The next release will put some groundwork for it, but then the release after it might actually have them!"
Discord thread about modular .wasp files
3. Another Discord thread confirms this is a planned feature:
- "YES this is coming in a future update but isn't possible at the moment"
Discord thread about splitting main.wasp
For now, you'll need to keep all your Prisma entity definitions in the main.wasp
file. The Wasp team is not only planning to support splitting the .wasp
file but potentially creating "modular pieces of whole Wasp apps," which would be a more comprehensive solution.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Alex | ClipStake, 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?If this is not possible, please add it to top priority, it's quite important for large projects xd
Wohooo @Alex | ClipStake, you just became a Waspeteer level 1!
Hey @Alex | ClipStake, currently we don't support it but we have an issue for it. Thanks for mentioning it, helps us order our priorities.
https://github.com/wasp-lang/wasp/issues/2397
GitHub
Prisma now supports multiple Prisma schema files (prismaSchemaFolde...
They added support for multiple files, as long as they are in a directory that you specify, but we haven't followed up with that in Wasp, we are still assuming there is only a single file. We s...