Bug #372 - MediaEntry.thumbnail_file not used
authorCaleb Forbes Davis V <caldavis@gmail.com>
Wed, 10 Aug 2011 17:48:23 +0000 (12:48 -0500)
committerCaleb Forbes Davis V <caldavis@gmail.com>
Wed, 10 Aug 2011 17:48:23 +0000 (12:48 -0500)
- deleted the thumbnail_file from the media_entries collection
- added a migration to remove the field from previous db versions

mediagoblin/db/migrations.py
mediagoblin/db/models.py

index 6a8ebcf920d49ee1f64a722f7ca6184bf1af9781..8c0881450b6dc849d51ba1746a1cd431d0a83ae1 100644 (file)
@@ -52,3 +52,13 @@ def mediaentry_mediafiles_main_to_original(database):
         document['media_files']['original'] = original
 
         collection.save(document)
+
+@RegisterMigration(3)
+def mediaentry_remove_thumbnail_file(database):
+    """
+    Use media_files['thumb'] instead of media_entries['thumbnail_file']
+    """
+    database['media_entries'].update(
+        {'thumbnail_file': {'$exists': True}},
+        {'$unset': {'thumbnail_file': 1}},
+        multi=True)
index 4ef2d928466ca67500a1352cec2814a443a7c0d8..aff2a65be5028cbe776374cf5682c497a8bc13e1 100644 (file)
@@ -169,8 +169,6 @@ class MediaEntry(Document):
      - attachment_files: A list of "attachment" files, ones that aren't
        critical to this piece of media but may be usefully relevant to people
        viewing the work.  (currently unused.)
-
-     - thumbnail_file: Deprecated... we should remove this ;)
     """
     __collection__ = 'media_entries'
 
@@ -196,10 +194,7 @@ class MediaEntry(Document):
 
         # The following should be lists of lists, in appropriate file
         # record form
-        'attachment_files': list,
-
-        # This one should just be a single file record
-        'thumbnail_file': [unicode]}
+        'attachment_files': list}
 
     required_fields = [
         'uploader', 'created', 'media_type', 'slug']