diff options
author | Chris Moylan <chris@chrismoylan.com> | 2011-07-10 22:45:52 -0500 |
---|---|---|
committer | Chris Moylan <chris@chrismoylan.com> | 2011-07-10 22:45:52 -0500 |
commit | 3d073d48cbf797c3da7b19670b8696d2229cce9b (patch) | |
tree | ff32c6b125ccf791d2adc70064d2f7bc7ae6ef3b /mediagoblin/db/util.py | |
parent | 9df37e8a4a9387e9ebe6690d0f18b94a31d7ae4d (diff) | |
parent | 3054e2b3cb08839aca7da2e1c5b4cce1768bf705 (diff) | |
download | mediagoblin-3d073d48cbf797c3da7b19670b8696d2229cce9b.tar.lz mediagoblin-3d073d48cbf797c3da7b19670b8696d2229cce9b.tar.xz mediagoblin-3d073d48cbf797c3da7b19670b8696d2229cce9b.zip |
Merge branch 'master' into test_submission_views_365
Diffstat (limited to 'mediagoblin/db/util.py')
-rw-r--r-- | mediagoblin/db/util.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mediagoblin/db/util.py b/mediagoblin/db/util.py index 70c37945..37e6586f 100644 --- a/mediagoblin/db/util.py +++ b/mediagoblin/db/util.py @@ -81,18 +81,25 @@ def remove_deprecated_indexes(database, deprecated_indexes=DEPRECATED_INDEXES): Args: - database: pymongo or mongokit database instance. - deprecated_indexes: the indexes to deprecate in the pattern of: - {'collection': ['index_identifier1', 'index_identifier2']} + {'collection_name': { + 'identifier': { + 'index': [index_foo_goes_here], + 'unique': True}} + + (... although we really only need the 'identifier' here, as the + rest of the information isn't used in this case. But it's kept + around so we can remember what it was) Returns: A list of indexes removed in form ('collection', 'index_name') """ indexes_removed = [] - for collection_name, index_names in deprecated_indexes.iteritems(): + for collection_name, indexes in deprecated_indexes.iteritems(): collection = database[collection_name] collection_indexes = collection.index_information().keys() - for index_name in index_names: + for index_name, index_data in indexes.iteritems(): if index_name in collection_indexes: collection.drop_index(index_name) |