#35749 closed Bug (duplicate)
AlterIndexTogether raising TypeError: 'class Meta' got invalid attribute(s): index_together
Reported by: | Dishen Wang | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | 5.1 |
Severity: | Normal | Keywords: | AlterIndexTogether, index_together |
Cc: | Dishen Wang | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
According to the documentation: "The AlterIndexTogether migration operation is now officially supported only for pre-Django 4.2 migration files. For backward compatibility reasons, it’s still part of the public API, and there’s no plan to deprecate or remove it, but it should not be used for new migrations. Use AddIndex and RemoveIndex operations instead." But when running make migrate it gave error TypeError: 'class Meta' got invalid attribute(s): index_together
. Is this an issue or should am I misunderstanding the problem?
Change History (4)
comment:1 by , 2 months ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 6 hours ago
It seems like the suggested workaround is to squash migrations, but unfortunately the AlterIndexTogether operation is still included in the squashed migration, so this does not help.
comment:3 by , 6 hours ago
That is correct Andrés, The work around for me was to modify the old migration/squashed files and replace AlterIndexTogether with a pair of operations RemoveIndex then AddIndex. You can then check for migrations and make sure the there are no changes after the modifications.
comment:4 by , 4 hours ago
Thank you! I will do that.
However it seems to me like this a very valid bug report and it should not be marked as closed.
I think AlterIndexTogether should either be completely removed, or fixed so that it does not crash. The current state is quite confusing.
Duplicate of #34856, #35679
The 4.2 release notes say the following: