W
Wasp4mo ago
ComputO

is there a way to enable entities with lowercase

i want to create my entities that are starting with lowercase so as to make app with already present db. I was able to create prisma schema using prisma db pull but wasp app does not allow entities that start with lowercase
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @ComputO. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Wasp does not allow entity names that start with a lowercase letter. As of version 0.12.0, entity names in your main.wasp file must start with an uppercase letter. This is a mandatory casing convention enforced by Wasp:
Entity names must start with an uppercase letter: entity Task {...}
Migration from 0.11.X to 0.12.X: Migrating declaration names There is no documented way to override this restriction. If you want to use an existing database schema with lowercase table names, you would need to adjust your Wasp entity definitions to use uppercase names, even if the underlying tables are lowercase. Wasp’s conventions are currently strict in this regard, and the knowledge sources do not mention any configuration or workaround to allow lowercase entity names. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ComputO, 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?
genyus
genyus4mo ago
As the bot said, you can't use lower-case entity names, but you can use Prisma's @@map attribute to map your entities to tables with different names:
model Comment {
// Your fields
@@map("comment")
}
model Comment {
// Your fields
@@map("comment")
}
Database mapping | Prisma Documentation
Database mapping in Prisma schema
Filip
Filip4mo ago
Hey @ComputO, Wasp dissalows Prisma entity names because Prisma discourages them. Genyus' s solution is, as usual, correct (thanks @genyus!)

Did you find this page helpful?