aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db/mongo')
-rw-r--r--mediagoblin/db/mongo/migrations.py20
-rw-r--r--mediagoblin/db/mongo/models.py4
2 files changed, 14 insertions, 10 deletions
diff --git a/mediagoblin/db/mongo/migrations.py b/mediagoblin/db/mongo/migrations.py
index 74a810c1..57da7dd8 100644
--- a/mediagoblin/db/mongo/migrations.py
+++ b/mediagoblin/db/mongo/migrations.py
@@ -29,6 +29,16 @@ def add_table_field(db, table_name, field_name, default_value):
multi=True)
+def drop_table_field(db, table_name, field_name):
+ """
+ Drop an old field from a table/collection
+ """
+ db[table_name].update(
+ {field_name: {'$exists': True}},
+ {'$unset': {field_name: 1}},
+ multi=True)
+
+
# Please see mediagoblin/tests/test_migrations.py for some examples of
# basic migrations.
@@ -118,11 +128,9 @@ def mediaentry_add_license(database):
@RegisterMigration(9)
-def user_remove_bio_html(database):
+def remove_calculated_html(database):
"""
- Drop bio_html again and calculate things on the fly (and cache)
+ Drop bio_html, description_html again and calculate things on the fly (and cache)
"""
- database['users'].update(
- {'bio_html': {'$exists': True}},
- {'$unset': {'bio_html': 1}},
- multi=True)
+ drop_table_field(database, 'users', 'bio_html')
+ drop_table_field(database, 'media_entries', 'description_html')
diff --git a/mediagoblin/db/mongo/models.py b/mediagoblin/db/mongo/models.py
index c1282f4a..db38d502 100644
--- a/mediagoblin/db/mongo/models.py
+++ b/mediagoblin/db/mongo/models.py
@@ -110,9 +110,6 @@ class MediaEntry(Document, MediaEntryMixin):
up with MarkDown for slight fanciness (links, boldness, italics,
paragraphs...)
- - description_html: Rendered version of the description, run through
- Markdown and cleaned with our cleaning tool.
-
- media_type: What type of media is this? Currently we only support
'image' ;)
@@ -177,7 +174,6 @@ class MediaEntry(Document, MediaEntryMixin):
'slug': unicode,
'created': datetime.datetime,
'description': unicode, # May contain markdown/up
- 'description_html': unicode, # May contain plaintext, or HTML
'media_type': unicode,
'media_data': dict, # extra data relevant to this media_type
'plugin_data': dict, # plugins can dump stuff here.