@@ -36,10 +36,13 @@ public NpgsqlMigrator(
36
36
IModelRuntimeInitializer modelRuntimeInitializer ,
37
37
IDiagnosticsLogger < DbLoggerCategory . Migrations > logger ,
38
38
IRelationalCommandDiagnosticsLogger commandLogger ,
39
- IDatabaseProvider databaseProvider )
39
+ IDatabaseProvider databaseProvider ,
40
+ IMigrationsModelDiffer migrationsModelDiffer ,
41
+ IDesignTimeModel designTimeModel ,
42
+ IDbContextOptions contextOptions )
40
43
: base ( migrationsAssembly , historyRepository , databaseCreator , migrationsSqlGenerator , rawSqlCommandBuilder ,
41
44
migrationCommandExecutor , connection , sqlGenerationHelper , currentContext , modelRuntimeInitializer , logger ,
42
- commandLogger , databaseProvider )
45
+ commandLogger , databaseProvider , migrationsModelDiffer , designTimeModel , contextOptions )
43
46
{
44
47
_historyRepository = historyRepository ;
45
48
_connection = connection ;
@@ -51,7 +54,7 @@ public NpgsqlMigrator(
51
54
/// any release. You should only use it directly in your code with extreme caution and knowing that
52
55
/// doing so can result in application failures when updating to a new Entity Framework Core release.
53
56
/// </summary>
54
- public override void Migrate ( string ? targetMigration = null )
57
+ public override void Migrate ( string ? targetMigration )
55
58
{
56
59
var appliedMigrations = _historyRepository . GetAppliedMigrations ( ) ;
57
60
@@ -60,17 +63,15 @@ public override void Migrate(string? targetMigration = null)
60
63
PopulateMigrations (
61
64
appliedMigrations . Select ( t => t . MigrationId ) ,
62
65
targetMigration ,
63
- out var migrationsToApply ,
64
- out var migrationsToRevert ,
65
- out _ ) ;
66
+ out var migratorData ) ;
66
67
67
- if ( migrationsToRevert . Count + migrationsToApply . Count == 0 )
68
+ if ( migratorData . RevertedMigrations . Count + migratorData . AppliedMigrations . Count == 0 )
68
69
{
69
70
return ;
70
71
}
71
72
72
73
// If a PostgreSQL extension, enum or range was added, we want Npgsql to reload all types at the ADO.NET level.
73
- var migrations = migrationsToApply . Count > 0 ? migrationsToApply : migrationsToRevert ;
74
+ var migrations = migratorData . AppliedMigrations . Count > 0 ? migratorData . AppliedMigrations : migratorData . RevertedMigrations ;
74
75
var reloadTypes = migrations
75
76
. SelectMany ( m => m . UpOperations )
76
77
. OfType < AlterDatabaseOperation > ( )
@@ -96,9 +97,7 @@ public override void Migrate(string? targetMigration = null)
96
97
/// any release. You should only use it directly in your code with extreme caution and knowing that
97
98
/// doing so can result in application failures when updating to a new Entity Framework Core release.
98
99
/// </summary>
99
- public override async Task MigrateAsync (
100
- string ? targetMigration = null ,
101
- CancellationToken cancellationToken = default )
100
+ public override async Task MigrateAsync ( string ? targetMigration , CancellationToken cancellationToken = default )
102
101
{
103
102
var appliedMigrations = await _historyRepository . GetAppliedMigrationsAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
104
103
@@ -107,17 +106,15 @@ public override async Task MigrateAsync(
107
106
PopulateMigrations (
108
107
appliedMigrations . Select ( t => t . MigrationId ) ,
109
108
targetMigration ,
110
- out var migrationsToApply ,
111
- out var migrationsToRevert ,
112
- out _ ) ;
109
+ out var migratorData ) ;
113
110
114
- if ( migrationsToRevert . Count + migrationsToApply . Count == 0 )
111
+ if ( migratorData . RevertedMigrations . Count + migratorData . AppliedMigrations . Count == 0 )
115
112
{
116
113
return ;
117
114
}
118
115
119
116
// If a PostgreSQL extension, enum or range was added, we want Npgsql to reload all types at the ADO.NET level.
120
- var migrations = migrationsToApply . Count > 0 ? migrationsToApply : migrationsToRevert ;
117
+ var migrations = migratorData . AppliedMigrations . Count > 0 ? migratorData . AppliedMigrations : migratorData . RevertedMigrations ;
121
118
var reloadTypes = migrations
122
119
. SelectMany ( m => m . UpOperations )
123
120
. OfType < AlterDatabaseOperation > ( )
0 commit comments