Skip to content

Commit b7cba29

Browse files
author
Joseph Palermo
committed
If a VERSION file does not exist in the data director, but existing data directories exist,
print an error and exit. We no longer have the postgres 9 packages to be able to upgrade from these versions. Users will have to upgrade to an older first first.
1 parent 16014c5 commit b7cba29

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,12 @@ function main() {
4242
chmod 700 "${PG_STORE_DIR}"
4343

4444
if [ ! -f ${VERSION_FILE} ]; then
45-
for version in "postgres-9.6.8" "postgres-9.6.6" "postgres-9.6.4"; do
46-
if [[ -d "${PG_STORE_DIR}/${version}" ]]; then
47-
if [[ -f "${PG_STORE_DIR}/${version}/postgresql.conf" ]]; then
48-
echo "Creating the PostgreSQL data version file at version ${version}"
49-
echo ${version} > ${VERSION_FILE}
50-
chown -R vcap:vcap "${VERSION_FILE}"
51-
chmod 700 "${VERSION_FILE}"
52-
pgversion_upgrade_from=${version}
53-
DATA_DIR_OLD="${PG_STORE_DIR}/${version}"
54-
PACKAGE_DIR_OLD=/var/vcap/packages/${version}
55-
break
56-
fi
57-
fi
58-
done
45+
existing_data_dirs=$(compgen -G "${PG_STORE_DIR}/postgres-*")
46+
47+
if [ -n "${existing_data_dirs}" ]; then
48+
echo "Found existing data dirs that we cannot upgrade from in this release. Upgrade to and older version first."
49+
exit 1
50+
fi
5951
fi
6052

6153
mkdir -p "${LOG_DIR}"

0 commit comments

Comments
 (0)