mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
Privileges for public
Schema in PostgreSQL 15+ (#347)
Co-authored-by: Bernard Sarfo Twumasi <bst@smartocean.com>
This commit is contained in:
committed by
GitHub
parent
113607aae3
commit
0f810f4077
@ -1,5 +1,16 @@
|
||||
if ! sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"__database__\" TO \"__username__\";"; then
|
||||
USER_TO_LINK='__username__'
|
||||
DB_NAME='__database__'
|
||||
DB_VERSION='__version__'
|
||||
|
||||
if ! sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"$DB_NAME\" TO $USER_TO_LINK;"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Linking to __database__ finished"
|
||||
# Check if PostgreSQL version is 15 or greater
|
||||
if [ "$DB_VERSION" -ge 15 ]; then
|
||||
if ! sudo -u postgres psql -d "$DB_NAME" -c "GRANT USAGE, CREATE ON SCHEMA public TO $USER_TO_LINK;"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Linking to $DB_NAME finished"
|
||||
|
Reference in New Issue
Block a user