- Added handling for DeepL exceptions - Added debug logging for im- and exporting - When executing the post script for the unique id migration, ensure that new id are generated, only when no id exists - Fixed section export by loading references to parents
35 lines
982 B
C#
35 lines
982 B
C#
using DataModel.Database.Common;
|
|
|
|
namespace DataModel.MigrationScripts;
|
|
|
|
public static class Script202211AddUniqueIds
|
|
{
|
|
public static async Task PostMigrationAsync(DataContext db)
|
|
{
|
|
await foreach (var setting in db.Settings)
|
|
{
|
|
if(setting.UniqueId == Guid.Empty)
|
|
setting.UniqueId = Guid.NewGuid();
|
|
}
|
|
|
|
await foreach(var section in db.Sections)
|
|
{
|
|
if(section.UniqueId == Guid.Empty)
|
|
section.UniqueId = Guid.NewGuid();
|
|
}
|
|
|
|
await foreach (var textElement in db.TextElements)
|
|
{
|
|
if(textElement.UniqueId == Guid.Empty)
|
|
textElement.UniqueId = Guid.NewGuid();
|
|
}
|
|
|
|
await foreach (var translation in db.Translations)
|
|
{
|
|
if(translation.UniqueId == Guid.Empty)
|
|
translation.UniqueId = Guid.NewGuid();
|
|
}
|
|
|
|
await db.SaveChangesAsync();
|
|
}
|
|
} |