|
|
@@ -10,6 +10,7 @@ using System.Linq.Expressions;
|
|
|
using System.Reflection;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using InABox.Database.SQLite;
|
|
|
|
|
|
namespace PRS.Shared.Database_Update_Scripts;
|
|
|
|
|
|
@@ -52,9 +53,19 @@ internal class Update_8_58 : DatabaseUpdateScript
|
|
|
private static void ConvertLink<T>(IProvider provider, string fromLink, string toLink)
|
|
|
where T : Entity, new()
|
|
|
{
|
|
|
+
|
|
|
var fromColumn = new Column<T>(fromLink).SubColumn(new Column<IEntityLink>(x => x.ID));
|
|
|
var toColumn = new Column<T>(toLink).SubColumn(new Column<IEntityLink>(x => x.ID));
|
|
|
|
|
|
+ if (provider is SQLiteProvider p)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Information, "", $"Migrating {typeof(T).Name}.{fromColumn.Property} -> {typeof(T).Name}.{toColumn.Property}");
|
|
|
+ var sql =
|
|
|
+ $"update {typeof(T).Name} set [{toColumn.Property}]=[{fromColumn.Property}] where [{fromColumn.Property}] is not null and [{toColumn.Property}] is null";
|
|
|
+ p.Update(sql);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
var items = provider.Query(
|
|
|
Filter<T>.Where<Guid>(fromColumn).IsNotEqualTo(Guid.Empty)
|
|
|
.And<Guid>(toColumn).IsEqualTo(Guid.Empty),
|