def migrate_up(manager):
    """
    If the auth tables don't exist, we shouldn't try to set the permissions.

    The auth tables will exist if this is an existing Autotest installation. If
    they don't, then this is a fresh installation, and the user will run
    `manage.py syncdb` later, which will add the proper permissions.
    """
    if db_utils.auth_tables_exist(manager):
        manager.execute_script(UP_SQL)
Beispiel #2
0
def migrate_up(manager):
    """
    If the auth tables don't exist, we shouldn't try to set the permissions.

    See migration 059
    """
    if db_utils.auth_tables_exist(manager):
        management.setup_environ(settings)
        # These have to be imported after the environment is set up
        from django.contrib.contenttypes import management as content_management
        from django.contrib.auth import management as auth_management
        from django.db import models as db_models

        content_management.update_all_contenttypes()
        for app in db_models.get_apps():
            auth_management.create_permissions(app, None, 2)

        manager.execute_script(migration_059.UP_SQL)
def migrate_down(manager):
    if db_utils.auth_tables_exist(manager):
        manager.execute_script(DOWN_SQL)
Beispiel #4
0
def migrate_up(manager):
    if db_utils.auth_tables_exist(manager):
        manager.execute_script(UP_SQL)