initial commit
This commit is contained in:
21
clear_migrations.sh
Normal file
21
clear_migrations.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Find all directories that contain a migrations folder (Django apps)
|
||||
while IFS= read -r -d '' dir; do
|
||||
app_dir="${dir%/migrations}"
|
||||
app_name="$(basename "$app_dir")"
|
||||
echo "clean migrations $app_name ..."
|
||||
find "$dir" -maxdepth 1 -type f -name "*.py" ! -name "__init__.py" -delete
|
||||
find "$dir" -maxdepth 1 -type f -name "*.pyc" -delete
|
||||
find "$dir" -maxdepth 1 -type f -name "*.pyc" -delete
|
||||
find "$dir" -maxdepth 1 -type f -name "*.py~" -delete
|
||||
find "$dir" -maxdepth 1 -type f -name "*.pyo" -delete
|
||||
find "$dir" -maxdepth 1 -type f -name "*.swp" -delete
|
||||
done < <(find . -type d -name migrations -print0)
|
||||
|
||||
echo "clear all."
|
||||
|
||||
#run
|
||||
# ./clear_migrations.sh
|
||||
Reference in New Issue
Block a user