1
0
Fork 0
mirror of synced 2024-06-29 11:30:46 +12:00

wrap migrations maker in try catch

This commit is contained in:
Nick Sweeting 2024-06-03 03:02:00 -07:00
parent c63917a22d
commit f574d34357
No known key found for this signature in database

View file

@ -143,7 +143,12 @@ def list_migrations(out_dir: Path=OUTPUT_DIR) -> List[Tuple[bool, str]]:
def apply_migrations(out_dir: Path=OUTPUT_DIR) -> List[str]: def apply_migrations(out_dir: Path=OUTPUT_DIR) -> List[str]:
from django.core.management import call_command from django.core.management import call_command
null, out = StringIO(), StringIO() null, out = StringIO(), StringIO()
call_command("makemigrations", interactive=False, stdout=null) try:
call_command("makemigrations", interactive=False, stdout=null)
except Exception as e:
print('[!] Failed to create some migrations. Please open an issue and copy paste this output for help: {}'.format(e))
print()
call_command("migrate", interactive=False, stdout=out) call_command("migrate", interactive=False, stdout=out)
out.seek(0) out.seek(0)