From 289a0ba844775e61fd40c58ea549064838218aa1 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 26 Nov 2024 14:12:00 +0100 Subject: [PATCH 1/2] Updating Npgsql to version 4.0.17 (the latest minor version of the closest major version that isn't vulnerable) https://github.com/OrchardCMS/Orchard/security/dependabot/54 --- src/Orchard.Web/Orchard.Web.csproj | 26 +++++++++++++++++++++----- src/Orchard.Web/packages.config | 8 +++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index f793ce0b4db..d27f5f65286 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -72,17 +72,14 @@ ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - ..\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll - ..\packages\MySql.Data.6.7.9\lib\net45\MySql.Data.dll ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - - ..\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll + + ..\packages\Npgsql.4.0.17\lib\net451\Npgsql.dll ..\packages\Orchard.NuGet.Core.1.1.0.0\lib\NuGet.Core.dll @@ -91,6 +88,9 @@ ..\packages\Owin.1.0\lib\net40\Owin.dll + + ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll + 3.5 @@ -100,7 +100,23 @@ ..\..\lib\sqlce\System.Data.SqlServerCe.dll True + + ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + diff --git a/src/Orchard.Web/packages.config b/src/Orchard.Web/packages.config index d27ff611903..65eb437e640 100644 --- a/src/Orchard.Web/packages.config +++ b/src/Orchard.Web/packages.config @@ -11,7 +11,13 @@ - + + + + + + + \ No newline at end of file From 4b21f0e95bb2ff902fc49afbb3bd539b54c35006 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 26 Nov 2024 15:41:50 +0100 Subject: [PATCH 2/2] Fixing that Projection Migrations created indexes with the same name in different tables, which is not supported by PostgreSQL --- .../Modules/Orchard.Projections/Migrations.cs | 70 ++++++++++++------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs index cf0b6f57e16..fbcc658ed0a 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs @@ -72,17 +72,7 @@ public int Create() { SchemaBuilder.CreateTable("FieldIndexPartRecord", table => table.ContentPartRecord()); //Adds indexes for better performances in queries - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); + AddPropertyNameAndFieldIndexPartRecordIdIndexes(); // Query @@ -287,7 +277,7 @@ public int Create() { Description = T("The text from the Body part").Text }); - return 6; + return 8; } public int UpdateFrom1() { @@ -343,17 +333,7 @@ public int UpdateFrom4() { .AddColumn("LatestValue")); //Adds indexes for better performances in queries - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); + AddPropertyNameAndFieldIndexPartRecordIdIndexes(); SchemaBuilder.AlterTable("QueryPartRecord", table => table .AddColumn("VersionScope", c => c.WithLength(15))); @@ -386,5 +366,47 @@ public int UpdateFrom6() { return 7; } + + public int UpdateFrom7() { + SchemaBuilder.AlterTable("StringFieldIndexRecord", table => { + table.DropIndex("IX_PropertyName"); + table.DropIndex("IX_FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => { + table.DropIndex("IX_PropertyName"); + table.DropIndex("IX_FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => { + table.DropIndex("IX_PropertyName"); + table.DropIndex("IX_FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => { + table.DropIndex("IX_PropertyName"); + table.DropIndex("IX_FieldIndexPartRecord_Id"); + }); + + AddPropertyNameAndFieldIndexPartRecordIdIndexes(); + + return 8; + } + + private void AddPropertyNameAndFieldIndexPartRecordIdIndexes() { + SchemaBuilder.AlterTable("StringFieldIndexRecord", table => { + table.CreateIndex("IDX_StringFieldIndexRecord_PropertyName", "PropertyName"); + table.CreateIndex("IDX_StringFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => { + table.CreateIndex("IDX_IntegerFieldIndexRecord_PropertyName", "PropertyName"); + table.CreateIndex("IDX_IntegerFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => { + table.CreateIndex("IDX_DoubleFieldIndexRecord_PropertyName", "PropertyName"); + table.CreateIndex("IDX_DoubleFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => { + table.CreateIndex("IDX_DecimalFieldIndexRecord_PropertyName", "PropertyName"); + table.CreateIndex("IDX_DecimalFieldIndexRecord_FieldIndexPartRecord_Id", "FieldIndexPartRecord_Id"); + }); + } } -} \ No newline at end of file +}