Skip to content

Commit 90c61f8

Browse files
committed
Added a check to bin/mkrelease, preventing releases with both schema change migrations and data migrations. Data migrations often take some time, which will delay the time between the schema changes and deployment of the matching new code.
- Legacy-Id: 13028
1 parent 7296b95 commit 90c61f8

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

bin/mkrelease

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,22 @@ DEV="$(printf %d.%d.%d.dev0 $MAJOR $MINOR $NEXT)"
170170

171171
#cd $DIR ??
172172

173+
note "Checking that changelog information is available ..."
174+
changes=$( sed -n "/^$PROJ ($VER.*)/,/^ -- /p" changelog )
175+
[ "$changes" ] || die "No changelog information for $VER found"
176+
#note "$changes"
177+
178+
note "Checking that we don't have both schema and data migrations"
179+
cur=$(svn info | awk '/^Revision:/ { print $2 }')
180+
migrations=$(svn log $PWD -v -r HEAD:$((cur-100)) | sed -n -e '1,/^Set version info and settings back to development mode/p' | grep '^...A /.*/migrations/0.*.py' | cut -c6- | awk '{ print $1 }' | sed -re 's|/trunk/||')
181+
if [ -n "$migrations" ]; then
182+
datamigr=$(for m in "$migrations"; do egrep -sl 'migrations\.RunPython' $m; done || true)
183+
schemamigr=$(for m in "$migrations"; do egrep -sl 'migrations\.(Add|Alter|Create|Delete|Remove|Rename)(Field|Model|UniqueTogether)' $m; done || true)
184+
if [ -n "$datamigr" -a -n "$schemamigr" ]; then
185+
die "\n Found both data migrations and schema migrations in this release.\n This is likely to cause delay between schema changes and deployment,\n which means the old code will run on the new schema longer than necessary."
186+
fi
187+
fi
188+
173189
note "Updating bower assets ..."
174190
$do ietf/manage.py bower_install > .mkrelease-bower-install.log
175191
$do rm .mkrelease-bower-install.log # This happens at once unless the previous command returns error
@@ -189,11 +205,6 @@ $do svn commit static/lib/ -m "Updated static files under static/lib/"
189205
# TCLOG=$(ls -t ../test-crawl-*.log | head -n 1)
190206
# [ $TCLOG -nt .svn/.latest-commit ] || die "Looked for ../test-crawl-*.log, but didn't find one newer than the latest repository commit ($RDATE)"
191207

192-
note "Checking that changelog information is available ..."
193-
changes=$( sed -n "/^$PROJ ($VER.*)/,/^ -- /p" changelog )
194-
[ "$changes" ] || die "No changelog information for $VER found"
195-
#note "$changes"
196-
197208
note "Upgrading the python library modules before checking migrations and running tests ..."
198209
pip install --upgrade -r requirements.txt
199210

0 commit comments

Comments
 (0)