_template-service/devuitls.sh
adam fc574d5002
Some checks failed
gitea.arg.rip/_template-service/pipeline/head There was a failure building this commit
it's going to be a dotnet service, let's be real.
and you're getting a database, if you don't like it remove it.
2024-12-13 14:30:08 -05:00

24 lines
823 B
Bash
Executable File

#!/bin/bash
servicename="$REPO_NAME"
pw_developmentdatabase="wnmhOttjA0wCiR9hVoG7jjrf90SxWvAV"
connnectionstr="Host=localhost;Database=${servicename}_dev;Username=${servicename};Password=${pw_developmentdatabase};IncludeErrorDetail=true;"
case "$1" in
"initial")
sudo -u postgres psql -c "create database ${servicename}_dev;"
sudo -u postgres psql -c "create user $servicename with encrypted password '$pw_developmentdatabase';"
sudo -u postgres psql -c "grant all privileges on database ${servicename}_dev to $servicename;"
sudo -u postgres psql -d "${servicename}_dev" -c "GRANT ALL ON SCHEMA public TO $servicename"
;;
"dbupdate")
dotnet ef migrations add "$2"
dotnet ef database update --connection "$connnectionstr";;
*)
echo "Unknown command '$1', try 'initial'" ;;
esac