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
In many columns when it is reflect on the database most of the names have this pattern ({col_name}_id_id) it is pretty annoying.
Description
What I suggest is to make the columns names in django models to be for example department instead of department_id and so one since django add suffix _id by its own
Use Case
[Explain how this feature would be useful and how it fits into the project's context.]
Proposed Solution
What I suggest is to make the columns names in django models to be for example department instead of department_id and so one since django add suffix _id by its own
Benefits
clear database naming
Labels
enhancement
Priority
medium
The text was updated successfully, but these errors were encountered:
Thank you for bringing up this issue and for the detailed explanation, Django automatically adds the _id suffix to foreign key fields, which can lead to redundancy when naming columns in the database, such as department_id_id.
Use Case
We understand that clear and concise naming in the database is crucial for readability and maintenance. Redundant suffixes can cause confusion and clutter, especially when working directly with the database or in raw SQL queries.
Proposed Solution
To address this, we propose leveraging Django's db_column attribute in model fields. This allows us to specify custom column names directly, avoiding the double _id suffix issue. For instance:
This way, the actual database column will be named department instead of department_id.
Next Steps
We'll evaluate the impact of implementing this change across the project and consider including it in future updates. If anyone has additional thoughts or concerns, please share them here.
Thanks again for your suggestion and contribution to improving our project!
Feature Request
In many columns when it is reflect on the database most of the names have this pattern ({col_name}_id_id) it is pretty annoying.
Description
What I suggest is to make the columns names in django models to be for example
department
instead ofdepartment_id
and so one since django add suffix_id
by its ownUse Case
[Explain how this feature would be useful and how it fits into the project's context.]
Proposed Solution
What I suggest is to make the columns names in django models to be for example
department
instead ofdepartment_id
and so one since django add suffix_id
by its ownBenefits
clear database naming
Labels
enhancement
Priority
medium
The text was updated successfully, but these errors were encountered: