Add management command to perform steps required after an upgrade.
This commit is contained in:
@@ -69,7 +69,8 @@ What's new in Mayan EDMS v2.0
|
||||
* Normalization of 'title' and 'name' fields to 'label'
|
||||
* Split tests files.
|
||||
* Document image and intermediate file caching now has it's own storage backend.
|
||||
|
||||
* RGB tags
|
||||
* ``performupgrade`` management command.
|
||||
|
||||
Upgrading from a previous version
|
||||
=================================
|
||||
@@ -102,8 +103,7 @@ Common steps
|
||||
|
||||
Migrate existing database schema with::
|
||||
|
||||
$ mayan-edms.py purge_permissions
|
||||
$ mayan-edms.py migrate
|
||||
$ mayan-edms.py performupgrade
|
||||
|
||||
During the migration several messages of stale content types can occur:
|
||||
|
||||
|
||||
14
mayan/apps/common/management/commands/performupgrade.py
Normal file
14
mayan/apps/common/management/commands/performupgrade.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.core import management
|
||||
|
||||
from ...signals import perform_upgrade
|
||||
|
||||
|
||||
class Command(management.BaseCommand):
|
||||
help = 'Performs the required steps after a version upgrade.'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
management.call_command('migrate', interactive=False)
|
||||
management.call_command('purgeperiodictasks', interactive=False)
|
||||
perform_upgrade.send(sender=self)
|
||||
@@ -3,3 +3,4 @@ from __future__ import unicode_literals
|
||||
from django.dispatch import Signal
|
||||
|
||||
post_initial_setup = Signal(use_caching=True)
|
||||
perform_upgrade = Signal(use_caching=True)
|
||||
|
||||
@@ -5,8 +5,10 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from common import (
|
||||
MayanAppConfig, menu_multi_item, menu_object, menu_secondary, menu_setup
|
||||
)
|
||||
from common.signals import perform_upgrade
|
||||
from rest_api.classes import APIEndPoint
|
||||
|
||||
from .handlers import purge_permissions
|
||||
from .models import Role
|
||||
from .links import (
|
||||
link_permission_grant, link_permission_revoke, link_role_create,
|
||||
@@ -28,3 +30,5 @@ class PermissionsApp(MayanAppConfig):
|
||||
menu_multi_item.bind_links(links=[link_permission_grant, link_permission_revoke], sources=['permissions:role_permissions'])
|
||||
menu_secondary.bind_links(links=[link_role_list, link_role_create], sources=[Role, 'permissions:role_create', 'permissions:role_list'])
|
||||
menu_setup.bind_links(links=[link_role_list])
|
||||
|
||||
perform_upgrade.connect(purge_permissions, dispatch_uid='purge_permissions')
|
||||
|
||||
7
mayan/apps/permissions/handlers.py
Normal file
7
mayan/apps/permissions/handlers.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.core import management
|
||||
|
||||
|
||||
def purge_permissions(**kwargs):
|
||||
management.call_command('purgepermissions')
|
||||
Reference in New Issue
Block a user