2019-01-26 21:59:21 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from django.core.management.base import CommandError
|
|
|
|
|
from django.core.management.commands.makemigrations import Command as BaseCommand
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
|
def handle(self, *apps_label, **options):
|
|
|
|
|
"""
|
|
|
|
|
Running makemigrations in production can have desastrous consequences.
|
|
|
|
|
|
|
|
|
|
We ensure the command is disabled, unless a specific env var is provided.
|
|
|
|
|
"""
|
|
|
|
|
force = os.environ.get("FORCE") == "1"
|
|
|
|
|
if not force:
|
|
|
|
|
raise CommandError(
|
2026-01-24 16:16:49 -03:00
|
|
|
"Running makemigrations on your FunQuail instance can have desastrous"
|
2019-01-26 21:59:21 +01:00
|
|
|
" consequences. This command is disabled, and should only be run in "
|
|
|
|
|
"development environments."
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return super().handle(*apps_label, **options)
|