diff options
author | buttle <chris@gatopelao.org> | 2023-10-24 18:41:31 +0200 |
---|---|---|
committer | buttle <chris@gatopelao.org> | 2023-10-24 19:20:52 +0200 |
commit | 9ce4ece30d0cbde234b8f87a597eef0c01130160 (patch) | |
tree | c5bc882ae0afec19951a19a5e36d5e733748f279 | |
parent | ab11dc8f36bd65836a4fc1b511faa0f67a8fa2de (diff) |
adds prompt to database deletefix/db-permission
-rw-r--r-- | docs/INSTALL.md | 2 | ||||
-rwxr-xr-x | liberaforms/commands/postgres.sh | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 8b98676f..5cb4ee70 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -79,8 +79,6 @@ DB_PASSWORD=a_secret_db_password Create a user and database with the `.env` values -If you encounter permission problems, try this - ``` sudo su su postgres -c "liberaforms/commands/postgres.sh create-db" diff --git a/liberaforms/commands/postgres.sh b/liberaforms/commands/postgres.sh index db4cee3b..74b82835 100755 --- a/liberaforms/commands/postgres.sh +++ b/liberaforms/commands/postgres.sh @@ -17,14 +17,16 @@ then psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD'" psql -c "CREATE DATABASE $DB_NAME OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0" psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER" - #psql -c "\c $DB_NAME postgres" - #psql -c "GRANT ALL ON SCHEMA public TO $DB_USER;" exit 0 fi if [[ "${1}" == "drop-db" ]] then - psql -c "DROP DATABASE $DB_NAME" - psql -c "DROP USER IF EXISTS $DB_USER" - exit 0 + echo "Drop database: $DB_NAME? y/n" + read confirm + if [[ $confirm == y* ]]; then + psql -c "DROP DATABASE $DB_NAME" + psql -c "DROP USER IF EXISTS $DB_USER" + exit 0 + fi fi |