mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	This prevents `get_user_profile_by_api_key` from doing a sequential scan. Doing this requires moving the generation of initial api_key values into the column definition, so that even bare calls to `UserProfile.objects.create` (e.g. from tests) call appropriately generate a random initial value.
		
			
				
	
	
		
			21 lines
		
	
	
		
			490 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			490 B
		
	
	
	
		
			Python
		
	
	
	
	
	
# Generated by Django 4.2.1 on 2023-05-18 15:20
 | 
						|
 | 
						|
 | 
						|
from django.db import migrations, models
 | 
						|
 | 
						|
from zerver.lib.utils import generate_api_key
 | 
						|
 | 
						|
 | 
						|
class Migration(migrations.Migration):
 | 
						|
    dependencies = [
 | 
						|
        ("zerver", "0450_backfill_subscription_auditlogs"),
 | 
						|
    ]
 | 
						|
 | 
						|
    operations = [
 | 
						|
        migrations.AlterField(
 | 
						|
            model_name="userprofile",
 | 
						|
            name="api_key",
 | 
						|
            field=models.CharField(default=generate_api_key, max_length=32, unique=True),
 | 
						|
        ),
 | 
						|
    ]
 |