Annotate zerver.migrations.

This commit is contained in:
Tim Abbott 2016-06-28 16:32:57 -07:00
parent c8aae360be
commit 56e7a2f6f3
3 changed files with 7 additions and 1 deletions

View File

@ -17,7 +17,6 @@ bots/zephyr_mirror_backend.py
tools/deprecated/ tools/deprecated/
zproject/settings.py zproject/settings.py
zproject/test_settings.py zproject/test_settings.py
zerver/migrations/
zerver/tests/test_bugdown.py zerver/tests/test_bugdown.py
zerver/tests/test_email_mirror.py zerver/tests/test_email_mirror.py
zerver/tests/test_decorators.py zerver/tests/test_decorators.py

View File

@ -1,11 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import models, migrations, connection from django.db import models, migrations, connection
from django.conf import settings from django.conf import settings
# Translate the UserProfile fields back to the old Guardian model # Translate the UserProfile fields back to the old Guardian model
def unmigrate_guardian_data(apps, schema_editor): def unmigrate_guardian_data(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None
Permission = apps.get_model('auth', 'Permission') Permission = apps.get_model('auth', 'Permission')
ContentType = apps.get_model('contenttypes', 'ContentType') ContentType = apps.get_model('contenttypes', 'ContentType')
UserProfile = apps.get_model('zerver', 'UserProfile') UserProfile = apps.get_model('zerver', 'UserProfile')
@ -38,6 +41,7 @@ def unmigrate_guardian_data(apps, schema_editor):
# Migrate all the guardian data for which users are realm admins or # Migrate all the guardian data for which users are realm admins or
# API super users to the new fields on the UserProfile model # API super users to the new fields on the UserProfile model
def migrate_guardian_data(apps, schema_editor): def migrate_guardian_data(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None
Permission = apps.get_model('auth', 'Permission') Permission = apps.get_model('auth', 'Permission')
ContentType = apps.get_model('contenttypes', 'ContentType') ContentType = apps.get_model('contenttypes', 'ContentType')
UserProfile = apps.get_model('zerver', 'UserProfile') UserProfile = apps.get_model('zerver', 'UserProfile')

View File

@ -2,11 +2,14 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import models, migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.conf import settings from django.conf import settings
from zerver.models import Recipient from zerver.models import Recipient
def migrate_existing_data(apps, schema_editor): def migrate_existing_data(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None
Attachment = apps.get_model('zerver', 'Attachment') Attachment = apps.get_model('zerver', 'Attachment')
Stream = apps.get_model('zerver', 'Stream') Stream = apps.get_model('zerver', 'Stream')