Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# (c) 2018-2020 

2# MPIB <https://www.mpib-berlin.mpg.de/>, 

3# MPI-CBS <https://www.cbs.mpg.de/>, 

4# MPIP <http://www.psych.mpg.de/> 

5# 

6# This file is part of Castellum. 

7# 

8# Castellum is free software; you can redistribute it and/or modify it 

9# under the terms of the GNU Affero General Public License as published 

10# by the Free Software Foundation; either version 3 of the License, or 

11# (at your option) any later version. 

12# 

13# Castellum is distributed in the hope that it will be useful, but 

14# WITHOUT ANY WARRANTY; without even the implied warranty of 

15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

16# Affero General Public License for more details. 

17# 

18# You should have received a copy of the GNU Affero General Public 

19# License along with Castellum. If not, see 

20# <http://www.gnu.org/licenses/>. 

21 

22from django.conf import settings 

23from django.core.management.base import BaseCommand 

24from django.core.management.commands.migrate import Command as MigrateCommand 

25 

26 

27class Command(BaseCommand): 

28 help = "Update database schema of all databases." 

29 

30 def handle(self, *args, **kwargs): 

31 migrate = MigrateCommand() 

32 

33 options = { 

34 'app_label': None, 

35 'migration_name': None, 

36 'interactive': True, 

37 'fake': False, 

38 'fake_initial': False, 

39 'run_syncdb': False, 

40 'plan': False, 

41 } 

42 options.update(kwargs) 

43 

44 for database in settings.DATABASES: 

45 options['database'] = database 

46 if options['verbosity'] >= 1: 

47 self.stdout.write(self.style.MIGRATE_HEADING("Database:")) 

48 self.stdout.write(' ' + database) 

49 migrate.handle(*args, **options) 

50 if options['verbosity'] >= 1: 

51 self.stdout.write('')