From: Joar Wandborg Date: Sun, 10 Jun 2012 13:53:46 +0000 (+0200) Subject: Merge remote-tracking branch 'is_derek/bug405_email_notifications_for_comments' into... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=879ff4bde6afaee8bf5bdc2a0e659d66e767d424;p=mediagoblin.git Merge remote-tracking branch 'is_derek/bug405_email_notifications_for_comments' into notifications-merge Conflicts: mediagoblin/db/mongo/migrations.py --- 879ff4bde6afaee8bf5bdc2a0e659d66e767d424 diff --cc mediagoblin/db/mongo/migrations.py index 732f5846,1984ecc4..569dec88 --- a/mediagoblin/db/mongo/migrations.py +++ b/mediagoblin/db/mongo/migrations.py @@@ -173,28 -170,9 +173,36 @@@ def convert_gps_media_data(database) 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)