Skip to content

Commit f46029e

Browse files
committed
chore: check file existence before running psql against it
1 parent 4af43eb commit f46029e

File tree

2 files changed

+3
-25
lines changed

2 files changed

+3
-25
lines changed

ansible/files/admin_api_scripts/pg_upgrade_complete.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ function complete_pg_upgrade {
6060

6161
if [ -d /data/sql ]; then
6262
for FILE in /data/sql/*.sql; do
63-
run_sql -f $FILE
63+
if [ -f "$FILE" ]; then
64+
run_sql -f $FILE
65+
fi
6466
done
6567
fi
6668

ansible/files/admin_api_scripts/pg_upgrade_initiate.sh

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,6 @@ run_sql() {
2424
psql -h localhost -U supabase_admin -d postgres -c "$STATEMENT"
2525
}
2626

27-
function shutdown_services {
28-
if [[ $(systemctl is-active gotrue) == "active" ]]; then
29-
echo "stopping gotrue"
30-
systemctl stop gotrue || true
31-
fi
32-
33-
if [[ $(systemctl is-active postgrest) == "active" ]]; then
34-
echo "stopping postgrest"
35-
systemctl stop postgrest || true
36-
fi
37-
}
38-
39-
function start_services {
40-
if [[ $(systemctl is-active gotrue) == "inactive" ]]; then
41-
echo "starting gotrue"
42-
systemctl start gotrue || true
43-
fi
44-
45-
if [[ $(systemctl is-active postgrest) == "inactive" ]]; then
46-
echo "starting postgrest"
47-
systemctl start postgrest || true
48-
fi
49-
}
50-
5127
cleanup() {
5228
UPGRADE_STATUS=${1:-"failed"}
5329
EXIT_CODE=${?:-0}

0 commit comments

Comments
 (0)