فهرست منبع

Improved performance of 8.58 Database Update Script

frogsoftware 2 روز پیش
والد
کامیت
fabbc083be

+ 1 - 1
prs.desktop/prsdesktop.iss

@@ -8,7 +8,7 @@
 #define public Dependency_Path_NetCoreCheck "dependencies\"
 
 #define MyAppName "PRS Desktop"
-#define MyAppVersion "8.55.7"
+#define MyAppVersion "8.58.0"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSDesktop.exe"

+ 1 - 1
prs.licensing/PRSLicensing.iss

@@ -8,7 +8,7 @@
 #define public Dependency_Path_NetCoreCheck "dependencies\"
 
 #define MyAppName "PRS Licensing"
-#define MyAppVersion "8.55.7"
+#define MyAppVersion "8.58.0"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSLicensing.exe"

+ 1 - 1
prs.server/PRSServer.iss

@@ -8,7 +8,7 @@
 #define public Dependency_Path_NetCoreCheck "dependencies\"
 
 #define MyAppName "PRS Server"
-#define MyAppVersion "8.55.7"
+#define MyAppVersion "8.58.0"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSServer.exe"

+ 11 - 0
prs.shared/Database Update Scripts/Update_8_58.cs

@@ -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),

+ 1 - 0
prs.shared/PRS.Shared.csproj

@@ -12,6 +12,7 @@
 
   <ItemGroup>
     <ProjectReference Include="..\..\inabox\inabox.client.rest\InABox.Client.Rest\InABox.Client.Rest.csproj" />
+    <ProjectReference Include="..\..\inabox\inabox.database.sqlite\InABox.Database.SQLite.csproj" />
     <ProjectReference Include="..\..\InABox\InABox.Database\InABox.Database.csproj" />
     <ProjectReference Include="..\..\inabox\inabox.mailer.exchange\InABox.Mailer.Exchange.csproj" />
     <ProjectReference Include="..\..\inabox\inabox.mailer.imap\InABox.Mailer.IMAP.csproj" />