In this commit, I added a new column which will be used for RDFa metadata of
authortilly-Q <nattilypigeonfowl@gmail.com>
Thu, 6 Feb 2014 20:15:57 +0000 (15:15 -0500)
committertilly-Q <nattilypigeonfowl@gmail.com>
Sun, 23 Mar 2014 20:38:45 +0000 (16:38 -0400)
media.

mediagoblin/db/migrations.py
mediagoblin/db/models.py

index 426080a2def9b0b573ef182e01336fa0e8489efd..a7400bf0e31f7086fdc44488e12beaed6bff3cdc 100644 (file)
@@ -31,6 +31,7 @@ from mediagoblin.db.migration_tools import (
     RegisterMigration, inspect_table, replace_table_hack)
 from mediagoblin.db.models import (MediaEntry, Collection, MediaComment, User, 
         Privilege)
+from mediagoblin.db.extratypes import JSONEncoded, MutationDict
 
 MIGRATIONS = {}
 
@@ -720,3 +721,14 @@ def drop_MediaEntry_collected(db):
     media_collected.drop()
 
     db.commit()
+
+@RegisterMigration(20, MIGRATIONS)
+def add_work_metadata_column(db):
+    metadata = MetaData(bind=db.bind)
+
+    media_file = inspect_table(metadata, 'core__mediafiles')
+
+    col = Column('work_metadata', MutationDict.as_mutable(JSONEncoded))
+    col.create(media_file)
+
+    db.commit()
index b750375d7b68b12b560c4fcb80dd93686e1d6585..ac69d040e3128404a8b0330b2b4bb1f69a29104b 100644 (file)
@@ -420,6 +420,7 @@ class MediaFile(Base):
     name_id = Column(SmallInteger, ForeignKey(FileKeynames.id), nullable=False)
     file_path = Column(PathTupleWithSlashes)
     file_metadata = Column(MutationDict.as_mutable(JSONEncoded))
+    work_metadata = Column(MutationDict.as_mutable(JSONEncoded))
 
     __table_args__ = (
         PrimaryKeyConstraint('media_entry', 'name_id'),