Changing things back so that we keep information about deprecated
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 9 Jul 2011 21:51:19 +0000 (16:51 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 9 Jul 2011 21:51:19 +0000 (16:51 -0500)
indexes around.

mediagoblin/db/util.py

index 70c37945d06f0a0c75e51fcc091a1f6349424373..37e6586f821be26e642a2a047bc1591d202fdef0 100644 (file)
@@ -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)