Opened 2 months ago

Closed 7 days ago

Last modified 7 days ago

#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 (8)

comment:1 by Sarah Boyce, 2 months ago

Resolution: duplicate
Status: newclosed

Duplicate of #34856, #35679

The 4.2 release notes say the following:

Next, consider squashing migrations to remove index_together from historical migrations.

comment:2 by Andrés Reverón Molina, 8 days 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 Dishen Wang, 8 days 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 Andrés Reverón Molina, 8 days 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.

comment:5 by Andrés Reverón Molina, 7 days ago

Resolution: duplicate
Status: closednew

comment:6 by Natalia Bidart, 7 days ago

Resolution: duplicate
Status: newclosed

Hola Andrés! I understand that you may feel frustrated by this but please do not reopen tickets closed by maintainers/Fellows, unless those are in needsinfo state and the reopening includes the requested extra information.

My advice at this point is that, if you disagree with the ticket resolution and/or want extra opinions on this matter, please consider starting a new conversation on the Django Forum, where you'll reach a broader audience and receive additional feedback.

comment:7 by Tim Graham, 7 days ago

I agree this matter is confusing and at least requires a documentation clarification. See ticket:34856#comment:5. I do not understand what backward compatibility purpose AlterIndexTogether serves when all it does is crash.

comment:8 by Simon Charette, 7 days ago

I agree that we need to have a large discussion on what can be done to reduce the friction here given the state of things and how far we are in the release and deprecation process. I believe this forum thread is likely the best location to discuss this further so I plan on providing my thoughts over there by EoD.

Version 0, edited 7 days ago by Simon Charette (next)
Note: See TracTickets for help on using tickets.
Back to Top