Skip to content

Instantly share code, notes, and snippets.

@michaelhelmick
Last active February 4, 2020 17:33
Show Gist options
  • Save michaelhelmick/7e6c6f3fb0cdd9821ed2504df7398627 to your computer and use it in GitHub Desktop.
Save michaelhelmick/7e6c6f3fb0cdd9821ed2504df7398627 to your computer and use it in GitHub Desktop.
Django Migration Conflicts
MIGRATION_CONFLICTS=$(shell find . -name "*.py" | grep -o ".*migrations/[0-9]\+" | sort | uniq -c | awk '$$1 > 1 {print $$0}')
migration-conflicts:
@if [ "${MIGRATION_CONFLICTS}" = "" ]; then \
echo "No migration conflicts found."; \
else \
echo "The following migration conflicts found:" && \
echo "${MIGRATION_CONFLICTS}" && exit 1; \
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment