Hmm, missing unique indexes on __retired__, key_value in mysql.
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all:
Well I just had a WTH moment.
I was working on the import issue where multiple entries with the same key
fail to import if a non-retired entry occurs before a retired entry.
I was sure my code was correct, but the mysql backend tests were
running to completion without triggering the fixup needed to handle the
out of order rows.
I finally tracked it down. Turns out the unique index on keyvalue and
retired state wasn't being applied.
Added a call to:
# and the unique index for key / retired(id)
self.add_class_key_required_unique_constraint(spec.classname,
spec.key)
at the end of back_mysql.py Database::create_class_table_indexes (so
it matches code in the same method in rdbms_common.py). Now my test
case works without issue.
However I am not sure what the implication of this change are for an
existing mysql database.
The only way this can cause an issue is if you have multiple active
objects with the same key. So any list for that class would show
doubled entries. If people don't have that issue, adding this index
shouldn't cause an issue. But.... this isn't my area of expertise so
quips, comments, evasions, questions or answers are welcome.
Thanks.
--
-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.