Opened 23 hours ago
Last modified 21 hours ago
#36645 closed Bug
PostgreSQL migration regression: `InternalError: cannot drop column id of table ... because other objects depend on it` — at Version 1
Reported by: | Adam Johnson | Owned by: | Adam Johnson |
---|---|---|---|
Component: | Migrations | Version: | 6.0 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When testing a client project on Django 6.0, its migrations fail to run, crashing with an exception like:
django.db.utils.InternalError: cannot drop column id of table library_book because other objects depend on it DETAIL: constraint ratings_rating_book_id_9d017958_fk_library_book_id on table ratings_rating depends on column id of table library_book HINT: Use DROP ... CASCADE to drop the dependent objects too.
The exact conditions:
- PostgreSQL (tested on 15 and reproduced on 18)
- A model that has been migrated from vanilla to use multi-table inheritance
- A model in another app that FK's to the first model, with its migration dependency on the first models' first migration.
Reproduction repository: https://github.com/adamchainz/django-ticket-36645
Note:
See TracTickets
for help on using tickets.