|
|
|
@ -224,6 +224,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MigrateMediaStreams(string file)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var backupFile = file + ".bak";
|
|
|
|
|
File.Copy(file, backupFile, true);
|
|
|
|
@ -235,18 +237,21 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
|
"REPLACE INTO mediastreams("+columns+") SELECT "+columns+" FROM MediaInfoOld.mediastreams;"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_connection.RunQueries(queries, _logger);
|
|
|
|
|
File.Delete(file);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.ErrorException("Error migrating media info database", ex);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
TryDeleteFile(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MigrateChapters(string file)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var backupFile = file + ".bak";
|
|
|
|
|
File.Copy(file, backupFile, true);
|
|
|
|
@ -256,14 +261,27 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
|
"REPLACE INTO "+ChaptersTableName+"(ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) SELECT ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath FROM ChaptersOld.Chapters;"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_connection.RunQueries(queries, _logger);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.ErrorException("Error migrating chapter database", ex);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
TryDeleteFile(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void TryDeleteFile(string file)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_connection.RunQueries(queries, _logger);
|
|
|
|
|
File.Delete(file);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.ErrorException("Error migrating chapter database", ex);
|
|
|
|
|
_logger.ErrorException("Error deleting file {0}", ex, file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|