mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	It's nicer to have these indexes properly registered, rather than hidden in RunSQL operations. Now that Django has had support for unique functional indexes for a while, let's clean this up.
		
			
				
	
	
		
			32 lines
		
	
	
		
			943 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			943 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from django.db import migrations, models
 | 
						|
from django.db.models.functions import Upper
 | 
						|
 | 
						|
 | 
						|
class Migration(migrations.Migration):
 | 
						|
    dependencies = [
 | 
						|
        ("zerver", "0294_remove_userprofile_pointer"),
 | 
						|
    ]
 | 
						|
 | 
						|
    operations = [
 | 
						|
        migrations.AddConstraint(
 | 
						|
            model_name="userprofile",
 | 
						|
            constraint=models.UniqueConstraint(
 | 
						|
                models.F("realm"),
 | 
						|
                Upper(models.F("email")),
 | 
						|
                name="zerver_userprofile_realm_id_email_uniq",
 | 
						|
            ),
 | 
						|
        ),
 | 
						|
        migrations.AddConstraint(
 | 
						|
            model_name="userprofile",
 | 
						|
            constraint=models.UniqueConstraint(
 | 
						|
                models.F("realm"),
 | 
						|
                Upper(models.F("delivery_email")),
 | 
						|
                name="zerver_userprofile_realm_id_delivery_email_uniq",
 | 
						|
            ),
 | 
						|
        ),
 | 
						|
        migrations.AlterUniqueTogether(
 | 
						|
            name="userprofile",
 | 
						|
            unique_together=set(),
 | 
						|
        ),
 | 
						|
    ]
 |