test-migrations: Clean up a bit.

This commit is contained in:
Greg Price 2018-02-09 18:43:26 -08:00 committed by Tim Abbott
parent 6d35a697af
commit 72497d61c1
1 changed files with 9 additions and 5 deletions

View File

@ -2,9 +2,13 @@
set -e set -e
echo 'Testing whether migrations are consistent with models' echo 'Testing whether migrations are consistent with models'
new_auto_named_migrations=$(./manage.py showmigrations | grep -v '0004_auto_20160423_0400\|0005_auto_20160727_2333\|0052_auto_fix_realmalias_realm_nullable\|0089_auto_20170710_1353\|0002_auto_20150110_0810\|0003_auto_20150817_1733\|0004_auto_20160205_1827\|0005_auto_20160224_0450' | grep "_auto_20" || true) # Check if any migration looks to have a meaningless 'auto' name,
# We check if there is any new migration with the 'auto' keyword in its name and # other than the existing handful from 2016 and 2017.
# cause a error to rename to a more meaningful name new_auto_named_migrations=$(./manage.py showmigrations \
| grep -E ' [0-9]{4}_auto_' \
| grep -Eve ' [0-9]{4}_auto_201[67]' \
-e ' 0052_auto_fix_realmalias_realm_nullable' \
|| true)
if [ "$new_auto_named_migrations" != "" ]; then if [ "$new_auto_named_migrations" != "" ]; then
echo "ERROR: New migrations with unclear automatically generated names." echo "ERROR: New migrations with unclear automatically generated names."
echo "Please rename these migrations to have readable names:" echo "Please rename these migrations to have readable names:"
@ -22,6 +26,6 @@ if ! ./manage.py makemigrations --check --dry-run; then
echo 'See https://zulip.readthedocs.io/en/latest/subsystems/schema-migrations.html for details.' echo 'See https://zulip.readthedocs.io/en/latest/subsystems/schema-migrations.html for details.'
echo echo
exit 1 exit 1
else
echo "Success! Migrations are consistent with models."
fi fi
echo "Success! Migrations are consistent with models."