diff --git a/.travis.yml b/.travis.yml index 0e0a27ad4..eb6abe0c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ before_script: - cp sapl/.env_test sapl/.env - psql -c "CREATE USER sapl WITH PASSWORD 'sapl'" -U postgres; - psql -c "CREATE DATABASE sapl OWNER sapl;" -U postgres + - ./check_migrations.sh script: - ./manage.py migrate diff --git a/check_migrations.sh b/check_migrations.sh new file mode 100755 index 000000000..31f042207 --- /dev/null +++ b/check_migrations.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +python manage.py makemigrations --dry-run --exit + +MIGRATIONS=$? + +NC='\033[0m' + +if [ $MIGRATIONS -eq 0 ]; then + RED='\033[0;31m' + echo -e "${RED}You have unapplied code changes. run 'python manage.py makemigrations' before submitting your code...${NC}" + exit 1 +else + GREEN='\033[0;32m' + echo -e "Working normally..." + exit 0 +fi \ No newline at end of file