Add script to drop and restore a database

This commit is contained in:
Ramon Wenger 2023-09-27 22:55:29 +02:00
parent f183a51317
commit ace09bd25a
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#!/bin/bash
while getopts d:f: flag
do
case "${flag}" in
d) database=${OPTARG};;
f) filename=${OPTARG};;
esac
done
psql -c "drop database $database;"
psql -c "create database $database with owner skillbox;"
pg_restore --verbose --clean --no-acl --no-owner -d $database $filename