mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
set -e
 | 
						|
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' | grep "_auto_20" || true)
 | 
						|
# We check if there is any new migration with the 'auto' keyword in its name and
 | 
						|
# cause a error to rename to a more meaningful name
 | 
						|
if [ "$new_auto_named_migrations" != "" ]; then
 | 
						|
    echo "ERROR: New migrations with unclear automatically generated names."
 | 
						|
    echo "Please rename these migrations to have readable names:"
 | 
						|
    echo
 | 
						|
    echo "$new_auto_named_migrations" | sed 's/\[[x ]\] /  /'
 | 
						|
    echo
 | 
						|
    echo 'See https://zulip.readthedocs.io/en/latest/schema-migrations.html for advice.'
 | 
						|
    echo
 | 
						|
    exit 1
 | 
						|
fi
 | 
						|
 | 
						|
if ! ./manage.py makemigrations --check --dry-run; then
 | 
						|
    echo
 | 
						|
    echo 'ERROR: Migrations are not consistent with models!  Fix with `./tools/renumber-migrations`.'
 | 
						|
    echo 'See http://zulip.readthedocs.io/en/latest/schema-migrations.html for details.'
 | 
						|
    echo
 | 
						|
    exit 1
 | 
						|
else
 | 
						|
    echo "Success!  Migrations are consistent with models."
 | 
						|
fi
 |