Skip to content

Commit

Permalink
fixed populator script
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Mar 25, 2024
1 parent d564800 commit ab5d8f4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
REM launches local SQL Server dependency so we can run from Visual Studio

pushd "%~dp0"
dotnet ef database update --no-build
popd
32 changes: 32 additions & 0 deletions src/cqrs/cqrs-sqlserver/start-dependencies.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
@echo off
REM launches local SQL Server dependency so we can run from Visual Studio


REM Step 0: Build the project
echo Building the project in release configuration...
dotnet build -c Release
if errorlevel 1 (
echo "Failed to build the solution - aborting"
exit /b -1
)


set version="0.1.0"
set imageName="akkadotnet.sqlserver"

Expand All @@ -23,4 +33,26 @@ if errorlevel 1 (
) else (
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourStrong(!)Password" -p 1533:1433 --name "sqlsharding-sql" -d "%imageName%:%version%"
)
)

REM Step 1: Execute EF Database Update
:EFDatabaseUpdate
set /A attemptCount+=1
echo Attempting to update the database, attempt %attemptCount%
echo "Calling %~dp0CqrsSqlServer.DataModel/populate-db.cmd"
call %~dp0CqrsSqlServer.DataModel/populate-db.cmd
if errorlevel 1 (
echo Attempt %attemptCount% failed to update database.
popd
if %attemptCount% lss 3 (
echo Waiting for 30 seconds before retry...
timeout /t 30
goto EFDatabaseUpdate
) else (
echo "Failed to update the database after 3 attempts - aborting"
exit /b -1
)
) else (
echo Database updated successfully.
popd
)

0 comments on commit ab5d8f4

Please sign in to comment.