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(
34
34
_connectionStringResolver = connectionStringResolver ;
35
35
}
36
36
37
- public void Run ( bool skipConnVerification )
37
+ public bool Run ( bool skipConnVerification )
38
38
{
39
39
var hostConnStr = _connectionStringResolver . GetNameOrConnectionString ( new ConnectionStringResolveArgs ( MultiTenancySides . Host ) ) ;
40
40
if ( hostConnStr . IsNullOrWhiteSpace ( ) )
41
41
{
42
42
Log . Write ( "Configuration file should contain a connection string named 'Default'" ) ;
43
- return ;
43
+ return false ;
44
44
}
45
45
46
46
Log . Write ( "Host database: " + ConnectionStringHelper . GetConnectionString ( hostConnStr ) ) ;
@@ -51,7 +51,7 @@ public void Run(bool skipConnVerification)
51
51
if ( ! command . IsIn ( "Y" , "y" ) )
52
52
{
53
53
Log . Write ( "Migration canceled." ) ;
54
- return ;
54
+ return false ;
55
55
}
56
56
}
57
57
@@ -66,7 +66,7 @@ public void Run(bool skipConnVerification)
66
66
Log . Write ( "An error occured during migration of host database:" ) ;
67
67
Log . Write ( ex . ToString ( ) ) ;
68
68
Log . Write ( "Canceled migrations." ) ;
69
- return ;
69
+ return false ;
70
70
}
71
71
72
72
Log . Write ( "HOST database migration completed." ) ;
@@ -108,6 +108,8 @@ public void Run(bool skipConnVerification)
108
108
}
109
109
110
110
Log . Write ( "All databases have been migrated." ) ;
111
+
112
+ return true ;
111
113
}
112
114
}
113
115
}
Original file line number Diff line number Diff line change @@ -26,7 +26,11 @@ public static void Main(string[] args)
26
26
27
27
using ( var migrateExecuter = bootstrapper . IocManager . ResolveAsDisposable < MultiTenantMigrateExecuter > ( ) )
28
28
{
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 ) ;
30
34
}
31
35
32
36
if ( ! _quietMode )
You can’t perform that action at this time.
0 commit comments