From 37d3ec5947b858827bca6198b445b5f18749cb76 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 12 Dec 2024 01:23:54 -0500 Subject: [PATCH] seems to work on balaam --- devuitls.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 devuitls.sh diff --git a/devuitls.sh b/devuitls.sh new file mode 100755 index 0000000..fa53547 --- /dev/null +++ b/devuitls.sh @@ -0,0 +1,25 @@ +#!/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 + +