File tree Expand file tree Collapse file tree
Modules/Grand.Module.Migration/Migrations/2.4
Tests/Grand.Infrastructure.Tests/Migrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments