You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
627 B

from mamweb.settings import INSTALLED_APPS
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
class Command(BaseCommand):
help = "Odmigruje všechny moduly (i.e. smaže všechny tabulky, ale databázi nechá)"
def add_arguments(self, parser):
# TODO: --force (makat a neblábolit)
pass
def handle(self, *args, **options):
# TODO: zeptat se
for app in INSTALLED_APPS:
app = app.split('.')[-1]
try:
call_command('migrate', app, 'zero')
except CommandError:
# app nemá migrace (aspoň typicky)
pass
call_command('showmigrations')