File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ @ echo off
2
+ REM launches local SQL Server dependency so we can run from Visual Studio
3
+
4
+ pushd " %~dp0 "
5
+ dotnet ef database update --no-build
6
+ popd
Original file line number Diff line number Diff line change 1
1
@ echo off
2
2
REM launches local SQL Server dependency so we can run from Visual Studio
3
3
4
+
5
+ REM Step 0: Build the project
6
+ echo Building the project in release configuration...
7
+ dotnet build -c Release
8
+ if errorlevel 1 (
9
+ echo " Failed to build the solution - aborting"
10
+ exit /b -1
11
+ )
12
+
13
+
4
14
set version = " 0.1.0"
5
15
set imageName = " akkadotnet.sqlserver"
6
16
@@ -23,4 +33,26 @@ if errorlevel 1 (
23
33
) else (
24
34
docker run -e " ACCEPT_EULA=Y" -e " SA_PASSWORD=yourStrong(!)Password" -p 1533:1433 --name " sqlsharding-sql" -d " %imageName% :%version% "
25
35
)
36
+ )
37
+
38
+ REM Step 1: Execute EF Database Update
39
+ :EFDatabaseUpdate
40
+ set /A attemptCount += 1
41
+ echo Attempting to update the database, attempt %attemptCount%
42
+ echo " Calling %~dp0 CqrsSqlServer.DataModel/populate-db.cmd"
43
+ call %~dp0 CqrsSqlServer.DataModel/populate-db.cmd
44
+ if errorlevel 1 (
45
+ echo Attempt %attemptCount% failed to update database.
46
+ popd
47
+ if %attemptCount% lss 3 (
48
+ echo Waiting for 30 seconds before retry...
49
+ timeout /t 30
50
+ goto EFDatabaseUpdate
51
+ ) else (
52
+ echo " Failed to update the database after 3 attempts - aborting"
53
+ exit /b -1
54
+ )
55
+ ) else (
56
+ echo Database updated successfully.
57
+ popd
26
58
)
You can’t perform that action at this time.
0 commit comments