Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Bump version 2.3 → 2.4 with DB migration (#666)

Copilot3278184f79be
diff --git a/src/Build/Grand.Common.props b/src/Build/Grand.Common.props
index bb4383b86..a6f74ff1f 100644
--- a/src/Build/Grand.Common.props
+++ b/src/Build/Grand.Common.props
@@ -42,7 +42,7 @@
</ItemGroup>
<Target Name="SetVersion" BeforeTargets="PrepareForBuild">
<PropertyGroup>
- <Version>2.3.0</Version>
+ <Version>2.4.0</Version>
</PropertyGroup>
</Target>
</Project>
\ No newline at end of file
diff --git a/src/Modules/Grand.Module.Migration/Migrations/2.4/MigrationUpgradeDbVersion_24.cs b/src/Modules/Grand.Module.Migration/Migrations/2.4/MigrationUpgradeDbVersion_24.cs
new file mode 100644
index 000000000..e4a86d7d1
--- /dev/null
+++ b/src/Modules/Grand.Module.Migration/Migrations/2.4/MigrationUpgradeDbVersion_24.cs
@@ -0,0 +1,35 @@
+using Grand.Data;
+using Grand.Domain.Common;
+using Grand.Infrastructure;
+using Grand.Infrastructure.Migrations;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Grand.Module.Migration.Migrations._2._4;
+
+public class MigrationUpgradeDbVersion_24 : IMigration
+{
+ public int Priority => 0;
+
+ public DbVersion Version => new(2, 4);
+
+ public Guid Identity => new("A1B2C3D4-E5F6-7890-ABCD-EF1234567890");
+
+ public string Name => "Upgrade version of the database to 2.4";
+
+ /// <summary>
+ /// Upgrade process
+ /// </summary>
+ /// <param name="serviceProvider"></param>
+ /// <returns></returns>
+ public bool UpgradeProcess(IServiceProvider serviceProvider)
+ {
+ var repository = serviceProvider.GetRequiredService<IRepository<GrandNodeVersion>>();
+
+ var dbversion = repository.Table.FirstOrDefault();
+ dbversion!.InstalledVersion = $"{GrandVersion.SupportedDBVersion}";
+ dbversion!.DataBaseVersion = $"{GrandVersion.SupportedDBVersion}";
+ repository.Update(dbversion);
+
+ return true;
+ }
+}
diff --git a/src/Tests/Grand.Infrastructure.Tests/Migrations/MigrationManagerTests.cs b/src/Tests/Grand.Infrastructure.Tests/Migrations/MigrationManagerTests.cs
index 2e1ba91b8..6482c1139 100644
--- a/src/Tests/Grand.Infrastructure.Tests/Migrations/MigrationManagerTests.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/Migrations/MigrationManagerTests.cs
@@ -18,7 +18,7 @@ public class MigrationManagerTests
[TestMethod]
public void GetCurrentMigrationsTest()
{
- var result = migrationManager.GetCurrentMigrations(new DbVersion(2,3));
+ var result = migrationManager.GetCurrentMigrations(new DbVersion(2,4));
Assert.AreEqual(1, result.Count());
}
}
\ No newline at end of file