Abdullah Zeeshan
PPrisma
•Created by Abdullah Zeeshan on 3/3/2025 in #help-and-questions
Usage of `@map` and `@@map` as a best practice to name tables and columns in a database
Say we have a legacy database somewhere that has its table names and column names.
One way to use
@map
and @@map
is to ensure that the names of our models and fields map to the names of the tables and columns, respectively in that database.
Apart from this use case, can I use these as a best practice whenever I am creating my Models where essentially a legacy database does not exist but I am building from scratch.
Example: When I define a Model named Category
and I use
Here the reason for using @@map
is just to ensure that the new table created in my database has the name categories
.
Essentially, this way I am thinking about what names I can pick for the columns and tables in my real database.4 replies