2020-09-26 16:19:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# aux script called by restore_scodoc_data.sh as "postgres" user
|
|
|
|
# DO NOT CALL DIRECTLY
|
|
|
|
|
|
|
|
PG_DUMPFILE=$1
|
|
|
|
|
|
|
|
|
|
|
|
# Drop all current ScoDoc databases, if any:
|
|
|
|
for f in $(psql -l --no-align --field-separator . | grep SCO | cut -f 1 -d.); do
|
2020-12-19 19:22:22 +01:00
|
|
|
echo dropping "$f"
|
|
|
|
dropdb "$f"
|
2020-09-26 16:19:37 +02:00
|
|
|
done
|
|
|
|
echo "Restoring postgres data..."
|
|
|
|
psql -f "$PG_DUMPFILE" postgres
|
|
|
|
|