Browse Source

Implementa script check_migrations (#1411)

* Adiciona rotina de checagem de migração

Signed-off-by: Eliseu Egewarth <eliseuegewarth@gmail.com>

* Adiciona Campos sem gerar makemigrations

Signed-off-by: Eliseu Egewarth <eliseuegewarth@gmail.com>

* Move script check_migrations.sh para o estagio 'before_script'

Signed-off-by: Eliseu Egewarth <eliseuegewarth@gmail.com>

* Revert "Adiciona Campos sem gerar makemigrations"

This reverts commit c61154ec86.

* Adding color for check failures

Signed-off-by: Eliseu Egewarth <eliseuegewarth@gmail.com>
pull/1416/head
Eliseu Egewarth 7 years ago
committed by Edward
parent
commit
1ea08c670f
  1. 1
      .travis.yml
  2. 17
      check_migrations.sh

1
.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

17
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
Loading…
Cancel
Save