This repository has been archived on 2023-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
discord-bot-shtik/devuitls.sh
2024-12-12 01:23:54 -05:00

26 lines
907 B
Bash
Executable File

#!/bin/bash
servicename="vassago"
pw_developmentdatabase="wnmhOttjA0wCiR9hVoG7jjrf90SxWvAV"
connnectionstr="Host=localhost;Database=${servicename}_dev;Username=${servicename};Password=${pw_developmentdatabase};IncludeErrorDetail=true;"
case "$1" in
"dbinit")
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"
#dotnet ef dbcontext scaffold "$connnectionstr" Npgsql.EntityFrameworkCore.PostgreSQL
;;
"dbupdate")
dotnet ef migrations add "$2"
dotnet ef database update --connection "$connnectionstr";;
*)
echo "Unknown command '$1', try 'dbinit'" ;;
esac