I18NCommander/I18N Commander/DataModel/MigrationScripts/202211AddUniqueIds.cs
Thorsten Sommer 4c6f5b59f0
Bugfixes
- 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
2023-02-11 21:22:25 +01:00

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();
}
}