Skip to content

Commit ab5d8f4

Browse files
committed
fixed populator script
1 parent d564800 commit ab5d8f4

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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

src/cqrs/cqrs-sqlserver/start-dependencies.cmd

+32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
@echo off
22
REM launches local SQL Server dependency so we can run from Visual Studio
33

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+
414
set version="0.1.0"
515
set imageName="akkadotnet.sqlserver"
616

@@ -23,4 +33,26 @@ if errorlevel 1 (
2333
) else (
2434
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourStrong(!)Password" -p 1533:1433 --name "sqlsharding-sql" -d "%imageName%:%version%"
2535
)
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 %~dp0CqrsSqlServer.DataModel/populate-db.cmd"
43+
call %~dp0CqrsSqlServer.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
2658
)

0 commit comments

Comments
 (0)