#30673 closed Bug (fixed)
Django throws error when different apps with different models have the same name table name.
Reported by: | dev-c | Owned by: | Adnan Umer |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.2 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Error message:
table_name: (models.E028) db_table 'table_name' is used by multiple models: base.ModelName, app2.ModelName.
We have a Base app that points to a central database and that has its own tables. We then have multiple Apps that talk to their own databases. Some share the same table names.
We have used this setup for a while, but after upgrading to Django 2.2 we're getting an error saying we're not allowed 2 apps, with 2 different models to have the same table names.
Is this correct behavior? We've had to roll back to Django 2.0 for now.
Change History (5)
follow-up: 2 comment:1 by , 5 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I agree with your opinion. Assigning to myself, patch on its way
Replying to Claude Paroz:
Regression in [5d25804eaf81795c7d457e5a2a9f0b9b0989136c], ticket #20098.
My opinion is that as soon as the project has a non-emptyDATABASE_ROUTERS
setting, the error should be turned into a warning, as it becomes difficult to say for sure that it's an error. And then the project can add the warning inSILENCED_SYSTEM_CHECKS
.
Regression in [5d25804eaf81795c7d457e5a2a9f0b9b0989136c], ticket #20098.
My opinion is that as soon as the project has a non-empty
DATABASE_ROUTERS
setting, the error should be turned into a warning, as it becomes difficult to say for sure that it's an error. And then the project can add the warning inSILENCED_SYSTEM_CHECKS
.