File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
aspnet-core/src/AbpCompanyName.AbpProjectName.Migrator Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,13 @@ public MultiTenantMigrateExecuter(
3434 _connectionStringResolver = connectionStringResolver ;
3535 }
3636
37- public void Run ( bool skipConnVerification )
37+ public bool Run ( bool skipConnVerification )
3838 {
3939 var hostConnStr = _connectionStringResolver . GetNameOrConnectionString ( new ConnectionStringResolveArgs ( MultiTenancySides . Host ) ) ;
4040 if ( hostConnStr . IsNullOrWhiteSpace ( ) )
4141 {
4242 Log . Write ( "Configuration file should contain a connection string named 'Default'" ) ;
43- return ;
43+ return false ;
4444 }
4545
4646 Log . Write ( "Host database: " + ConnectionStringHelper . GetConnectionString ( hostConnStr ) ) ;
@@ -51,7 +51,7 @@ public void Run(bool skipConnVerification)
5151 if ( ! command . IsIn ( "Y" , "y" ) )
5252 {
5353 Log . Write ( "Migration canceled." ) ;
54- return ;
54+ return false ;
5555 }
5656 }
5757
@@ -66,7 +66,7 @@ public void Run(bool skipConnVerification)
6666 Log . Write ( "An error occured during migration of host database:" ) ;
6767 Log . Write ( ex . ToString ( ) ) ;
6868 Log . Write ( "Canceled migrations." ) ;
69- return ;
69+ return false ;
7070 }
7171
7272 Log . Write ( "HOST database migration completed." ) ;
@@ -108,6 +108,8 @@ public void Run(bool skipConnVerification)
108108 }
109109
110110 Log . Write ( "All databases have been migrated." ) ;
111+
112+ return true ;
111113 }
112114 }
113115}
Original file line number Diff line number Diff line change @@ -26,7 +26,11 @@ public static void Main(string[] args)
2626
2727 using ( var migrateExecuter = bootstrapper . IocManager . ResolveAsDisposable < MultiTenantMigrateExecuter > ( ) )
2828 {
29- migrateExecuter . Object . Run ( _quietMode ) ;
29+ var migrationSucceeded = migrateExecuter . Object . Run ( _quietMode ) ;
30+ // exit clean (with exit code 0) if migration is a success, otherwise exit with code 1
31+ var exitCode = Convert . ToInt32 ( ! migrationSucceeded ) ;
32+
33+ Environment . Exit ( exitCode ) ;
3034 }
3135
3236 if ( ! _quietMode )
You can’t perform that action at this time.
0 commit comments