RegisterMigration, inspect_table, replace_table_hack)
from mediagoblin.db.models import (MediaEntry, Collection, MediaComment, User,
Privilege)
+from mediagoblin.db.extratypes import JSONEncoded, MutationDict
MIGRATIONS = {}
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()
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'),