Moved the metadata column to MediaEntry rather than MediaFile
authortilly-Q <nattilypigeonfowl@gmail.com>
Tue, 15 Apr 2014 17:51:27 +0000 (13:51 -0400)
committertilly-Q <nattilypigeonfowl@gmail.com>
Tue, 15 Apr 2014 17:51:27 +0000 (13:51 -0400)
mediagoblin/db/migrations.py
mediagoblin/db/models.py

index a7400bf0e31f7086fdc44488e12beaed6bff3cdc..294ab43b94878a44345a6514044de8a811805438 100644 (file)
@@ -723,12 +723,12 @@ def drop_MediaEntry_collected(db):
     db.commit()
 
 @RegisterMigration(20, MIGRATIONS)
-def add_work_metadata_column(db):
+def add_metadata_column(db):
     metadata = MetaData(bind=db.bind)
 
-    media_file = inspect_table(metadata, 'core__mediafiles')
+    media_entry = inspect_table(metadata, 'core__media_entries')
 
-    col = Column('work_metadata', MutationDict.as_mutable(JSONEncoded))
-    col.create(media_file)
+    col = Column('metadata', MutationDict.as_mutable(JSONEncoded))
+    col.create(media_entry)
 
     db.commit()
index ac69d040e3128404a8b0330b2b4bb1f69a29104b..7c0f0bf345195d07dcb747a3db23a889dd96d4ae 100644 (file)
@@ -264,6 +264,7 @@ class MediaEntry(Base, MediaEntryMixin):
         cascade="all, delete-orphan"
         )
     collections = association_proxy("collections_helper", "in_collection")
+    metadata = Column(MutationDict.as_mutable(JSONEncoded))
 
     ## TODO
     # fail_error
@@ -420,7 +421,6 @@ 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'),