Allow null to new unique keys on an existing collection when migrate
christosMichael opened this issue · 0 comments
christosMichael commented
One line description of the issue
When to add a new unique field in an existing collection and try to migrate and populate existing record with null it fails.
According to SQL standards when a field is unique null is as value is allowed
Python script
<class User(AbstractUser):
ROLES = {
'FREE_USER': 1,
'PREMIUM_USER': 2,
}
ROLE_CHOICES = (
(ROLES['FREE_USER'], 'Free User'),
(ROLES['PREMIUM_USER'], 'Premium User')
)
role = models.PositiveSmallIntegerField(choices=ROLE_CHOICES, blank=True, null=True, default=1)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=50)
initials = models.CharField(max_length=2)
email=models.EmailField(unique=True)
is_verified= models.BooleanField(default=False)
metamask_public_address=models.CharField(null=True, max_length=500, default=None, unique=True ) <-- NEW FIELD
nonce=models.CharField(max_length=300, default=None, null=True)
user_preferences_profiles = models.ArrayField(
model_container=UserPreferencesProfile,
default=[]
)>
<copy and paste code here>