Commit f00c1468 by Ahsan Ulhaq Committed by Ned Batchelder

Added unique constraint on email

ECOM-7085

(cherry picked from commit d141eb15)
parent 09c4c77b
# -*- 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 self._is_csmh(model): if model_name is not None:
return db == self.DATABASE_NAME model = hints.get('model')
elif db == self.DATABASE_NAME: if self._is_csmh(model):
return 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