You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to generate DBML for a database with a many-to-many relation, it fails with:
Cannot read properties of undefined (reading 'fieldIds')
Here is a reproduction code:
constcontent=`Table users { id int [pk]}Table projects { id int [pk]}Ref: projects.id <> users.id // many-to-many`constdb: Database=(newParser(undefined)).parse(content,'dbmlv2')constres=ModelExporter.export(db,'dbml',false)
The error is on the last line.
I also tried with a few variations:
use 'dbml' format instead of 'dbmlv2'
replace the last line with ModelExporter.export(db.normalize(), 'dbml', true)
inline relation (id int [pk, ref: <> users.id])
They all fail the same.
If I remove the many-to-many relation, it works well.
Am I doing something bad?
The text was updated successfully, but these errors were encountered:
Thank you for pointing this out. You are not doing it wrong.
Currently, we haven't handled the part of exporting to dbml for model_structure with n-n relationships (only when exporting to SQLs did we turn them into two one-to-many relationships). The reason for this is that n-n concepts are only presented in dbml, so there is no use case for converting n-n relationships from dbml to dbml.
Indeed the n-n relationships are not native to SQL databases but seems native to other databases, didn't know either ^^
I feel it's a bit strange to have a parser and a generator but they don't match on feature set: it's possible to write n-n relations in DBML but not to generate them ^^
Is it something you may change in the future or do you think it should stay like this?
When I try to generate DBML for a database with a many-to-many relation, it fails with:
Here is a reproduction code:
The error is on the last line.
I also tried with a few variations:
'dbml'
format instead of'dbmlv2'
ModelExporter.export(db.normalize(), 'dbml', true)
id int [pk, ref: <> users.id]
)They all fail the same.
If I remove the many-to-many relation, it works well.
Am I doing something bad?
The text was updated successfully, but these errors were encountered: