From ef7de98ad555cd2f3a36bc568c5ac2fddc108c1e Mon Sep 17 00:00:00 2001 From: Elrond Date: Tue, 13 Mar 2012 23:03:03 +0100 Subject: [PATCH] Convert media_data for video This creates fresh VideoData rows for all the videos in the mongodb. --- mediagoblin/db/sql/convert.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mediagoblin/db/sql/convert.py b/mediagoblin/db/sql/convert.py index 250c559b..ec737575 100644 --- a/mediagoblin/db/sql/convert.py +++ b/mediagoblin/db/sql/convert.py @@ -106,6 +106,19 @@ def convert_media_entries(mk_db): session.close() +def convert_video(mk_db): + session = Session() + + for media in mk_db.MediaEntry.find( + {'media_type': 'mediagoblin.media_types.video'}).sort('created'): + media_data_row = VideoData(*media.media_data) + media_data_row.media_entry = obj_id_table[media._id] + session.add(media_data_row) + + session.commit() + session.close() + + def convert_media_tags(mk_db): session = Session() session.autoflush = False @@ -167,6 +180,8 @@ def run_conversion(config_name): Session.remove() convert_media_entries(mk_db) Session.remove() + convert_video(mk_db) + Session.remove() convert_media_tags(mk_db) Session.remove() convert_media_comments(mk_db) -- 2.25.1