mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	populate_db: Clean up existing RemoteRealm, RemoteZulipServer objects.
As ofc9b0602320and8b55d60f9ewe create a default registration for the dev env "RemoteZulipServer" (and also RemoteRealms for the dev realms) in populate_db. However these models weren't listed in clear_database, meaning the state wasn't properly cleaned up at the start of the command. Most important, this would manifest in getting: ``` django.db.utils.IntegrityError: duplicate key value violates unique constraint "zilencer_remotezulipserver_uuid_key" DETAIL: Key (uuid)=(......) already exists ``` if you re-run populate_db.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							578f9fb77e
						
					
				
				
					commit
					24d6ae83c2
				
			@@ -73,7 +73,7 @@ from zerver.models import (
 | 
			
		||||
    get_user_by_delivery_email,
 | 
			
		||||
    get_user_profile_by_id,
 | 
			
		||||
)
 | 
			
		||||
from zilencer.models import RemoteZulipServer
 | 
			
		||||
from zilencer.models import RemoteRealm, RemoteZulipServer
 | 
			
		||||
from zilencer.views import update_remote_realm_data_for_server
 | 
			
		||||
 | 
			
		||||
settings.USING_TORNADO = False
 | 
			
		||||
@@ -128,6 +128,8 @@ def clear_database() -> None:
 | 
			
		||||
        UserMessage,
 | 
			
		||||
        Client,
 | 
			
		||||
        DefaultStream,
 | 
			
		||||
        RemoteRealm,
 | 
			
		||||
        RemoteZulipServer,
 | 
			
		||||
    ]:
 | 
			
		||||
        model.objects.all().delete()
 | 
			
		||||
    Session.objects.all().delete()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user