argos/dmp-db-scema/createDB/createdb.bat

8 lines
578 B
Batchfile

@echo off
setlocal
cd ..
for /F "tokens=*" %%p in ('type Docker\dmp-db.env') do SET %%p
psql -d postgres -U postgres -w --set=POSTGRES_USER=%POSTGRES_USER% --set=POSTGRES_PASSWORD=%POSTGRES_PASSWORD% --set=POSTGRES_DB=%POSTGRES_DB% -f main/createDatabase.sql
psql -d %POSTGRES_DB% -U %POSTGRES_USER% --set=POSTGRES_USER=%POSTGRES_USER% -w -f main/DataManagementPlanDB.sql
for /R "updates" %%f in (*.sql) do psql --set=ADMIN_USERNAME=%ADMIN_USERNAME% --set=ADMIN_PASSWORD=%ADMIN_PASSWORD% --set=POSTGRES_USER=%POSTGRES_USER% -d %POSTGRES_DB% -U %POSTGRES_USER% -w -f %%f
endlocal