{'$set': {'media_type': 'mediagoblin.media_types.image'}},
multi=True)
+
@RegisterMigration(8)
def mediaentry_add_license(database):
"""
drop_table_field(database, 'media_entries', 'description_html')
drop_table_field(database, 'media_comments', 'content_html')
+
@RegisterMigration(10)
def convert_video_media_data(database):
"""
document['media_data'] = document['media_data']['video']
collection.save(document)
+
@RegisterMigration(11)
def convert_gps_media_data(database):
"""
document['media_data']['gps_' + key] = value
del document['media_data']['gps']
collection.save(document)
+
+
+@RegisterMigration(12)
+def convert_exif_media_data(database):
+ """
+ Move media_data["exif"]["clean"] to media_data["exif_all"].
+ Drop media_data["exif"]["useful"]
+ In preparation for media_data.exif_all
+ """
+ collection = database['media_entries']
+ target = collection.find(
+ {'media_data.exif.clean': {'$exists': True}})
+
+ for document in target:
+ media_data = document['media_data']
+ print "old:", document['_id'], media_data
+ media_data['exif_all'] = media_data['exif'].pop('clean')
+ del media_data['exif']['useful']
+ assert len(media_data['exif']) == 0
+ del media_data['exif']
+ print "new:", document['_id'], media_data
+ collection.save(document)