Hey there everyone! Normally I use mongodb, but I ...
# orm-help
s
Hey there everyone! Normally I use mongodb, but I recently found prisma 2, and decided I should use postgresql instead for my current project. However, I have a couple of concerns. 1. How does the schema work? Do you write a schema in prisma and does prisma create it if it doesn't exist? 2. Is it possible to have the same id for certain node objects? I'll explain more about this question in the thread.
Some more explanation/context on the second question. I am creating a text chat bot. The bot needs to register each command in an database. However, I'm not sure how to. I could either use the name of the command or use an id. If I choose to have an id for each command, I have to either manually assign each command an id, or figure out a system to automatically give a command the same id. Here is an example command.
Copy code
@Command({
    description: "Replies '!hi' with hello."
}) // Note: Name is taken from method name
async hi({msg}: MsgData) {
    await msg.reply("hello");
}
I need to store the command description, name, etc in a database. And I need to figure out a way to give the hi command an id. If only there was an @id decorator that gave the command the same id every time.
r
Hey @SureDroid
How does the schema work? Do you write a schema in prisma and does prisma create it if it doesn't exist?
Yes you define a schema in a file named
schema.prisma
and yes Prisma does create it as explained here.
Is it possible to have the same id for certain node objects? I'll explain more about this question in the thread.
I think you would have to write this logic by yourself by checking if the commands are same and provide the id.