Django inadvertently removes all indexes when switching to db_index=False
    
    
    
      
      
      
        - Create a model with 
data = JSONField(db_index=True); makemigrations; migrate
 - Add a 
GinIndex(fields=['data'], name='foo') to _meta.indexes; makemigrations; migrate
 - Remove 
db_index=True from the JSONField; makemigrations; migrate
 
After step 2 there will be a Gin index on the data column on the model. After step 3 there's _no_ index on the data column anymore.
       
     
   
 
      
        
        
          Change History
          (6)
        
          
  
  
  
    
      | Has patch: | 
      
        set
       | 
    
    
      | Needs documentation: | 
      
        set
       | 
    
    
      | Needs tests: | 
      
        set
       | 
    
  
 
           
          
  
  
  
    
      | Needs documentation: | 
      
        unset
       | 
    
    
      | Needs tests: | 
      
        unset
       | 
    
  
 
           
          
  
  
  
    
      | Resolution: | 
      
        → fixed
       | 
    
    
      | Status: | 
      
        new → closed
       | 
    
  
 
           
          
          
          
          
         
       
     
        
    
    
PR