Add the value of @db.[typeAttr] to the DMMF structure for model fields
Problem
The current DMMF structure is very useful, but users are able to provide modifiers and attributes in the schema that do not yet appear in the generated DMMF structure.
In my case, the need arose to use the values of the database's native type attributes, including their parameters (eg: @db.VarChar(50)).
With this, we were able to generate query guidelines more precisely, avoiding errors in production.
Suggested solution
Include in the generated DMMF, in each field, of each model, the value of that attribute and its parameters, when it is used.
An example in DMMF:
{
"name": "fieldName",
"nativeType": {
"type": "VarChar",
"args": [50] // Parameters passed to attr, in order
},
...
}
And I take the opportunity to leave the suggestion of including the other attributes and modifiers that are possible to use in the schema and are not present in the DMMF. After all, if they are present in the schema, it is because they are somehow relevant, and therefore, they may end up being needed by generators.