Skip to content

Commit 8ad0d8e

Browse files
committed
Factor out creating upgrade.properties into a function
1 parent b27dd6c commit 8ad0d8e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

misc/scripts/prepare-db-upgrade.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,22 @@ if [ "${current_hash}" = "${prev_hash}" ]; then
124124
exit
125125
fi
126126

127+
create_upgrade_properties()
128+
{
129+
cat <<EOF > "$1/upgrade.properties"
130+
description: <INSERT DESCRIPTION HERE>
131+
compatibility: full|backwards|partial|breaking
132+
EOF
133+
}
134+
127135
# Copy current and new dbscheme into the upgrade dir
128136
upgradedir="${upgrade_root}/${prev_hash}"
129137
mkdir -p "${upgradedir}"
130138

131139
cp "${scheme_file}" "${upgradedir}"
132140
git cat-file blob "${prev_hash}" > "${upgradedir}/old.dbscheme"
133141

134-
# Create the template upgrade.properties file in the upgrade dir.
135-
cat <<EOF > "${upgradedir}/upgrade.properties"
136-
description: <INSERT DESCRIPTION HERE>
137-
compatibility: full|backwards|partial|breaking
138-
EOF
142+
create_upgrade_properties "${upgradedir}"
139143

140144
# Copy current and new dbscheme into the downgrade dir
141145
downgradedir="${downgrade_root}/${current_hash}"
@@ -144,11 +148,7 @@ mkdir -p "${downgradedir}"
144148
cp "${scheme_file}" "${downgradedir}/old.dbscheme"
145149
git cat-file blob "${prev_hash}" > "${downgradedir}/$(basename "${scheme_file}")"
146150

147-
# Create the template upgrade.properties file in the downgrade dir.
148-
cat <<EOF > "${downgradedir}/upgrade.properties"
149-
description: <INSERT DESCRIPTION HERE>
150-
compatibility: full|backwards|partial|breaking
151-
EOF
151+
create_upgrade_properties "${downgradedir}"
152152

153153
# Tell user what we've done
154154
cat <<EOF

0 commit comments

Comments
 (0)