#8507 closed (duplicate)
dumpdata/loaddata can't handle two of the same contenttypes having different IDs in different databases
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
Severity: | Keywords: | dumpdata loaddata | |
Cc: | eallik@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently loaddata and dumpdata are pretty dumb in that they are not able to identify when two objects/rows that have different database ID's are actually one and the same object (or equivalent).
For example, when dumping a dataset that has fkeys to the django_content_type table and then loading that data to another database which happens to have exactly the same content types installed but some of which have different database ID values, the outcome is an IntegrityError (or corrupted data). I think users should actually be able to do that without having to concern themselves with low level details such as database IDs.
As a potential solution, it could be possible define how two model objects compare two be able to match equivalent objects with different ID's.
As a side note, this could actually evolve to something that would also allow for callbacks to determine whether to overwrite a database object with an fixture object or not (for example, based on modification dates). This would simplify synchronizing databases and would not be difficult to implement either.
Duplicate of #7052