From: tilly-Q Date: Wed, 14 May 2014 15:56:59 +0000 (-0400) Subject: Set a default value to MediaEntry.media_metadata X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c8abeb58afd36c56af705a69a2d3ebec90002e74;p=mediagoblin.git Set a default value to MediaEntry.media_metadata --- diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 8dac3214..dd69ad6e 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -728,7 +728,8 @@ def add_metadata_column(db): media_entry = inspect_table(metadata, 'core__media_entries') - col = Column('media_metadata', MutationDict.as_mutable(JSONEncoded)) + col = Column('media_metadata', MutationDict.as_mutable(JSONEncoded), + default=MutationDict()) col.create(media_entry) db.commit() diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index defa0849..8499ea3f 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -264,7 +264,8 @@ class MediaEntry(Base, MediaEntryMixin): cascade="all, delete-orphan" ) collections = association_proxy("collections_helper", "in_collection") - media_metadata = Column(MutationDict.as_mutable(JSONEncoded)) + media_metadata = Column(MutationDict.as_mutable(JSONEncoded), + default=MutationDict()) ## TODO # fail_error