mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 10:59:17 +02:00
Fix #685: Disable makemigrations in production and misleading message when running migrate
This commit is contained in:
parent
264aa20db6
commit
78546232d0
3 changed files with 52 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
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(
|
||||
"Running makemigrations on your Funkwhale instance can have desastrous"
|
||||
" consequences. This command is disabled, and should only be run in "
|
||||
"development environments."
|
||||
)
|
||||
|
||||
return super().handle(*apps_label, **options)
|
Loading…
Add table
Add a link
Reference in a new issue