Replies: 2 comments
-
Hi @xuejmnet! Thanks for your interest in Liam! Easy Query is a cool ORM. I've given it a star!🌟 As for the answer, there's currently no intermediate structure explicitly defining relationships. At present, relationships are only established through foreign keys. As a workaround, you could use CI or similar tools to programmatically force the addition of foreign keys to the schema file beforehand. The following is an example using Ruby on Rails, but it should convey the concept. However, I understand this isn't the answer you're looking for. I also understand the need to visualize logical relationships. It might be useful to load configuration files in formats like JSON or YAML and customize the ER diagram display. |
Beta Was this translation helpful? Give feedback.
-
@MH4GF For the configuration file idea, what I currently have in mind looks something like this: {
"tableName": "user",
"comment": "your_table_comment",
"columns": [
{
"name": "column1",
"comment": "column1_comment",
"dbType": "VARCHAR(255)",
"notNull": true,
"generatedKey": false,
"defValue": null,
"primary": true
}
],
"@navigate": [
{
"type": "many2many",
"selfColumns": ["id"],
"targetTable": "role",
"targetColumns": ["id"],
"mappingTable": "user_role",
"selfMappingColumns": ["user_id"],
"targetMappingColumns": ["role_id"],
"required": false // true means foreign key with inner join, false means left join
}
]
} With a configuration like this, it would be possible to create one-way or two-way relationships without relying on actual foreign keys. Additionally, I’ve noticed (and some users have also reported) that when dealing with a large number of tables, rendering all of them at once can sometimes cause the application to become unresponsive. Once again, thank you for your feedback and consideration! 🙏 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am the author of Easy Query, an ORM framework.
I would love to use liam to visualize table relationships. However, there is a limitation with the current approach:
In real-world development, tables often have relationships that are not expressed as foreign keys in SQL. For example, a.id and b.aid may be logically related, but no foreign key constraint is defined in the database schema.
Because liam relies on SQL parsing, these relationships are not recognized, and the generated ER diagram cannot clearly represent the actual associations.
My question is:
👉 Is there an intermediate format (such as JSON or any other supported format) that allows me to define these relationships explicitly and then pass them to liam, so that liam can display the associations even if they are not defined as foreign keys in SQL?
This feature would be very useful for ORMs like Easy Query, where entity relationships are defined at the code level rather than enforced as database constraints.
Thanks a lot for your great work!
Beta Was this translation helpful? Give feedback.
All reactions