Skip to content

Commit 3278184

Browse files
authored
Bump version 2.3 → 2.4 with DB migration (#666)
* chore: bump version 2.3 -> 2.4, add MigrationUpgradeDbVersion_24 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 0c7c71d commit 3278184

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

src/Build/Grand.Common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</ItemGroup>
4343
<Target Name="SetVersion" BeforeTargets="PrepareForBuild">
4444
<PropertyGroup>
45-
<Version>2.3.0</Version>
45+
<Version>2.4.0</Version>
4646
</PropertyGroup>
4747
</Target>
4848
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Grand.Data;
2+
using Grand.Domain.Common;
3+
using Grand.Infrastructure;
4+
using Grand.Infrastructure.Migrations;
5+
using Microsoft.Extensions.DependencyInjection;
6+
7+
namespace Grand.Module.Migration.Migrations._2._4;
8+
9+
public class MigrationUpgradeDbVersion_24 : IMigration
10+
{
11+
public int Priority => 0;
12+
13+
public DbVersion Version => new(2, 4);
14+
15+
public Guid Identity => new("A1B2C3D4-E5F6-7890-ABCD-EF1234567890");
16+
17+
public string Name => "Upgrade version of the database to 2.4";
18+
19+
/// <summary>
20+
/// Upgrade process
21+
/// </summary>
22+
/// <param name="serviceProvider"></param>
23+
/// <returns></returns>
24+
public bool UpgradeProcess(IServiceProvider serviceProvider)
25+
{
26+
var repository = serviceProvider.GetRequiredService<IRepository<GrandNodeVersion>>();
27+
28+
var dbversion = repository.Table.FirstOrDefault();
29+
dbversion!.InstalledVersion = $"{GrandVersion.SupportedDBVersion}";
30+
dbversion!.DataBaseVersion = $"{GrandVersion.SupportedDBVersion}";
31+
repository.Update(dbversion);
32+
33+
return true;
34+
}
35+
}

src/Tests/Grand.Infrastructure.Tests/Migrations/MigrationManagerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void GetAllMigrationsTest()
1818
[TestMethod]
1919
public void GetCurrentMigrationsTest()
2020
{
21-
var result = migrationManager.GetCurrentMigrations(new DbVersion(2,3));
21+
var result = migrationManager.GetCurrentMigrations(new DbVersion(2,4));
2222
Assert.AreEqual(1, result.Count());
2323
}
2424
}

0 commit comments

Comments
 (0)