Commit 4926a6b2 by Ahsan Ulhaq Committed by GitHub

Merge pull request #14481 from edx/ahsan/ECOM-7085-Create-migration-unique-email

Added unique constraint on email
parents 31f178ea d141eb15
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('student', '0009_auto_20170111_0422'),
]
operations = [
migrations.RunSQL(
"create unique index email on auth_user (email);",
"drop index email on auth_user;"
)
]
...@@ -45,13 +45,15 @@ class StudentModuleHistoryExtendedRouter(object): ...@@ -45,13 +45,15 @@ class StudentModuleHistoryExtendedRouter(object):
return False return False
return None return None
def allow_migrate(self, db, model): # pylint: disable=unused-argument def allow_migrate(self, db, app_label, model_name=None, **hints): # pylint: disable=unused-argument
""" """
Only sync StudentModuleHistoryExtended to StudentModuleHistoryExtendedRouter.DATABASE_Name Only sync StudentModuleHistoryExtended to StudentModuleHistoryExtendedRouter.DATABASE_Name
""" """
if model_name is not None:
model = hints.get('model')
if self._is_csmh(model): if self._is_csmh(model):
return db == self.DATABASE_NAME return db == self.DATABASE_NAME
elif db == self.DATABASE_NAME: if db == self.DATABASE_NAME:
return False return False
return None return None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment