From e36ecab0931f25d65169bfcf26d8a56d33eef02a Mon Sep 17 00:00:00 2001 From: cfdv Date: Mon, 20 Jun 2011 13:07:15 -0500 Subject: [PATCH] adds accommmodations for migration of fields in User: bio and url --- mediagoblin/db/migrations.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index b87988fe..a3e7133c 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -49,5 +49,21 @@ class MediaEntryMigration(DocumentMigration): 'description_html': cleaned_markdown_conversion( doc['description'])}} - -MIGRATE_CLASSES = ['MediaEntry'] +class UserMigration(DocumentMigration): + def allmigration01_add_bio_and_url_profile(self): + """ + User can elaborate profile with home page and biography + """ + self.target = {'username': {'$exists': True}, 'url': {'$exists': False}, + 'bio': {'$exists': False}} + if not self.status: + for doc in self.collection.find(self.target): + self.update = { + '$set': { + 'url': '', + 'bio': ''}} + self.collection.update( + self.target, self.update, multi=True, safe=True) + + +MIGRATE_CLASSES = ['MediaEntry','User'] -- 2.25.1