Set a default value to MediaEntry.media_metadata
authortilly-Q <nattilypigeonfowl@gmail.com>
Wed, 14 May 2014 15:56:59 +0000 (11:56 -0400)
committertilly-Q <nattilypigeonfowl@gmail.com>
Wed, 14 May 2014 15:56:59 +0000 (11:56 -0400)
mediagoblin/db/migrations.py
mediagoblin/db/models.py

index 8dac321488e277f2f24e68fe24ad78841bfd54a8..dd69ad6e4f39e33b0f82210ff840690f189955af 100644 (file)
@@ -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()
index defa08492987a3647ffe97ed4e9eddd515405166..8499ea3fcea50a6db89713d108f86f268e640813 100644 (file)
@@ -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