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']
+
+ exif_all = media_data['exif'].pop('clean')
+ if len(exif_all):
+ media_data['exif_all'] = exif_all
+
+ del media_data['exif']['useful']
+
+ assert len(media_data['exif']) == 0
+ del media_data['exif']
+
+ collection.save(document)
++
++
++@RegisterMigration(13)
+ def user_add_wants_comment_notification(database):
+ """
+ Add wants_comment_notification to user model
+ """
+ add_table_field(database, 'users', 'wants_comment_notification', True)