Ticket #32 (accepted defect)
ContentType table is not updated when renaming table
| Reported by: | e.t.j.scheffers@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | The Future |
| Component: | migrations | Version: | 0.6-pre |
| Keywords: | Cc: |
Description
When a table is renamed, the ContentType? table is not updated, causing existing generic relations to fail.
Attachments
Change History
comment:2 Changed 3 years ago by andrew
- Status changed from new to accepted
- Milestone set to The Future
comment:3 Changed 2 years ago by anonymous
maybe you could have an 'update_contenttype' flag on the rename_table command?
although South deals with tables not models, if you're managing tables with South you're not going to get syncdb to update the content types for you.
comment:4 Changed 2 years ago by andrew
Perhaps, although given that ContentTypes? change so much anyway, I'm not entirely sure how to handle it. Remember, the DB records deal with model names, not table names.
The best I can probably do is provide a db.rename_content_type method which takes an old and new model name, and then at some point have --auto use that.

I'm not sure if this should be the job of the rename_table command; South (supposedly) deals strictly with tables, not models (the reason it works when a table is created is because we fire the post_syncdb signal).
I'd be tempted to instead add a new rename_contenttype command, and tell people to use that if they need it (some people don't use generic relations, and some tables aren't directly models, e.g. ManyToMany? tables).