From 7a29c67bf92830427e30590fe5a7b720da7520d4 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Thu, 6 Feb 2014 15:15:57 -0500 Subject: [PATCH] In this commit, I added a new column which will be used for RDFa metadata of media. --- mediagoblin/db/migrations.py | 12 ++++++++++++ mediagoblin/db/models.py | 1 + 2 files changed, 13 insertions(+) diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 426080a2..a7400bf0 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -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() diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index b750375d..ac69d040 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -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'), -- 2.25.1