Skip to content

Commit b68c2da

Browse files
committed
use wildcard for finding 11.x binaries
1 parent e0db9ce commit b68c2da

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.dev_builds/
22
/dev_releases/
33
*~
4+
config/private.yml

jobs/migrate-postgres/templates/pre-start.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [[ -d ${OLD_STORE_DIR} ]]; then
1414
until [ -d ${NEW_STORE_DIR}/postgres-* ] && [ "$(ps aux | grep jobs/postgres/bin/pre-start | wc -l)" = "1" ]; do
1515
sleep 1
1616
done
17-
17+
1818
# start old database
1919
# TODO: needs some checks
2020
chpst -u vcap:vcap ${POSTGRES_UNKNOWN_BIN}/pg_ctl -D /var/vcap/store/postgres/db start
@@ -45,7 +45,7 @@ if [[ -d ${OLD_STORE_DIR} ]]; then
4545
${POSTGRES_UNKNOWN_BIN}/psql -U vcap postgres -c 'ALTER DATABASE silkdb RENAME TO "network_connectivity";'
4646
${POSTGRES_UNKNOWN_BIN}/psql -U vcap postgres -c 'ALTER DATABASE routingapidb RENAME TO "routing-api";'
4747
${POSTGRES_UNKNOWN_BIN}/psql -U vcap postgres -c 'ALTER DATABASE uaadb RENAME TO "uaa";'
48-
48+
4949

5050
${POSTGRES_UNKNOWN_BIN}/psql -U vcap cloud_controller -c 'ALTER DATABASE "cloud_controller" OWNER TO "cloud_controller";'
5151
${POSTGRES_UNKNOWN_BIN}/psql -U vcap diego -c 'ALTER DATABASE "diego" OWNER TO "diego";'
@@ -72,7 +72,7 @@ if [[ -d ${OLD_STORE_DIR} ]]; then
7272
${POSTGRES_UNKNOWN_BIN}/psql -U vcap uaa -c 'REVOKE ALL ON DATABASE uaa FROM uaaadmin;'
7373
else
7474
echo "ccdb does not exists or is already renamed"
75-
fi
75+
fi
7676
# drop unsued admin dbs
7777
${POSTGRES_UNKNOWN_BIN}/dropdb --if-exists -U vcap uaaadmin
7878
${POSTGRES_UNKNOWN_BIN}/dropdb --if-exists -U vcap silkadmin
@@ -92,20 +92,20 @@ if [[ -d ${OLD_STORE_DIR} ]]; then
9292
${POSTGRES_UNKNOWN_BIN}/dropuser --if-exists -U vcap ccadmin
9393
${POSTGRES_UNKNOWN_BIN}/dropuser --if-exists -U vcap shield
9494

95-
96-
/var/vcap/packages/postgres-11.6/bin/pg_dumpall -E utf8 -U vcap -c --no-privileges -f all.sql
95+
96+
/var/vcap/packages/postgres-11.*/bin/pg_dumpall -E utf8 -U vcap -c --no-privileges -f all.sql
9797
sed -i 's/SQL_ASCII/UTF8/g' all.sql
9898
# TODO: can be a oneliner with import?
9999
cat all.sql | ${RECODE_BIN}/recode iso-8859-1..u8 > all-utf8.sql
100-
100+
101101
${POSTGRES_UNKNOWN_BIN}/psql -U vcap postgres < all-utf8.sql
102102

103103
# stop old database
104104
chpst -u vcap:vcap ${POSTGRES_UNKNOWN_BIN}/pg_ctl -D /var/vcap/store/postgres/db stop
105105
sleep 5
106106

107107
rm -rf "${NEW_STORE_DIR}/POSTGRES_DATA_VERSION"
108-
rm -rf "${NEW_STORE_DIR}/postgres-11.*"
108+
rm -rf "${NEW_STORE_DIR}/postgres-11.*"
109109
mv ${OLD_STORE_DIR} ${NEW_STORE_DIR}/postgres-unknown
110110
/var/vcap/jobs/postgres/bin/pre-start
111111
fi

0 commit comments

Comments
 (0)