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 @@ - 2.3.0 + 2.4.0 \ 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"; + + /// + /// Upgrade process + /// + /// + /// + public bool UpgradeProcess(IServiceProvider serviceProvider) + { + var repository = serviceProvider.GetRequiredService>(); + + 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 void GetAllMigrationsTest() [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