Moved the metadata column to MediaEntry rather than MediaFile
This commit is contained in:
parent
ecea4847e8
commit
9f3dc83a6c
@ -723,12 +723,12 @@ def drop_MediaEntry_collected(db):
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
@RegisterMigration(20, MIGRATIONS)
|
@RegisterMigration(20, MIGRATIONS)
|
||||||
def add_work_metadata_column(db):
|
def add_metadata_column(db):
|
||||||
metadata = MetaData(bind=db.bind)
|
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 = Column('metadata', MutationDict.as_mutable(JSONEncoded))
|
||||||
col.create(media_file)
|
col.create(media_entry)
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
@ -264,6 +264,7 @@ class MediaEntry(Base, MediaEntryMixin):
|
|||||||
cascade="all, delete-orphan"
|
cascade="all, delete-orphan"
|
||||||
)
|
)
|
||||||
collections = association_proxy("collections_helper", "in_collection")
|
collections = association_proxy("collections_helper", "in_collection")
|
||||||
|
metadata = Column(MutationDict.as_mutable(JSONEncoded))
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
# fail_error
|
# fail_error
|
||||||
@ -420,7 +421,6 @@ class MediaFile(Base):
|
|||||||
name_id = Column(SmallInteger, ForeignKey(FileKeynames.id), nullable=False)
|
name_id = Column(SmallInteger, ForeignKey(FileKeynames.id), nullable=False)
|
||||||
file_path = Column(PathTupleWithSlashes)
|
file_path = Column(PathTupleWithSlashes)
|
||||||
file_metadata = Column(MutationDict.as_mutable(JSONEncoded))
|
file_metadata = Column(MutationDict.as_mutable(JSONEncoded))
|
||||||
work_metadata = Column(MutationDict.as_mutable(JSONEncoded))
|
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
PrimaryKeyConstraint('media_entry', 'name_id'),
|
PrimaryKeyConstraint('media_entry', 'name_id'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user