Skip to content

Commit 2905966

Browse files
committed
fix: init file is needed for makemigrations
also make sure all migration files are formatted
1 parent 92df6c0 commit 2905966

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

bin/makemigrations.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/usr/bin/env bash
22
set -eux
33

4-
# copy old migrations to temporary directory
4+
# create temporary directory (if it doesn't already exist)
55

6-
cp -r benefits/core/migrations benefits/core/old_migrations
6+
mkdir -p benefits/core/old_migrations
7+
8+
# move old migrations to temporary directory, but keep init file
9+
10+
mv benefits/core/migrations/* benefits/core/old_migrations
11+
cp benefits/core/old_migrations/__init__.py benefits/core/migrations
712

813
# regenerate
914

@@ -14,8 +19,9 @@ python manage.py makemigrations
1419
cp benefits/core/old_migrations/* benefits/core/migrations --no-clobber --recursive
1520

1621
# clean up temporary directory
22+
1723
rm -rf benefits/core/old_migrations
1824

1925
# reformat with black
2026

21-
python -m black benefits/core/migrations/0001_initial.py
27+
python -m black benefits/core/migrations/*

0 commit comments

Comments
 (0)