      f_geometry_column = models.CharField(max_length=256)
      coord_dimension = models.IntegerField()
      srid = models.IntegerField(primary_key=True)
      spatial_index_enabled = models.IntegerField()
  
      class Meta:
          app_label = 'gis'
          db_table = 'geometry_columns'
          managed = False
 
</s> remove 

def add_spatial_version_related_fields(sender, **kwargs):
    """
    Adds fields after establishing a database connection to prevent database
    operations at compile time.
    """
    if connection_created.disconnect(add_spatial_version_related_fields, sender=DatabaseWrapper):
        spatial_version = connection.ops.spatial_version[0]
        if spatial_version >= 4:
            SpatialiteSpatialRefSys.add_to_class('srtext', models.CharField(max_length=2048))
            SpatialiteGeometryColumns.add_to_class('type', models.IntegerField(db_column='geometry_type'))
        else:
            SpatialiteGeometryColumns.add_to_class('type', models.CharField(max_length=30))
connection_created.connect(add_spatial_version_related_fields, sender=DatabaseWrapper)
 </s> add  </s> remove             type_col = 'type' if self.connection.ops.spatial_version < (4, 0, 0) else 'geometry_type'
            cursor.execute('SELECT coord_dimension, srid, %s '
 </s> add             cursor.execute('SELECT coord_dimension, srid, geometry_type ' </s> remove                            'WHERE f_table_name=%%s AND f_geometry_column=%%s' % type_col,
 </s> add                            'WHERE f_table_name=%s AND f_geometry_column=%s', </s> remove         if self.spatial_version < (3, 1, 0):
            unsupported.add('SnapToGrid')
        if self.spatial_version < (4, 0, 0):
            unsupported.update({'Perimeter', 'Reverse'})
        elif not self.lwgeom_version():
 </s> add         if not self.lwgeom_version():
    type = models.IntegerField(db_column='geometry_type')
      f_geometry_column = models.CharField(max_length=256)
      coord_dimension = models.IntegerField()
      srid = models.IntegerField(primary_key=True)
      spatial_index_enabled = models.IntegerField()
    type = models.IntegerField(db_column='geometry_type')
  
      class Meta:
          app_label = 'gis'
          db_table = 'geometry_columns'
          managed = False
keep keep keep add keep keep keep keep keep
 Fixed #25645 -- Dropped support for SpatiaLite < 4.0. 
django/contrib/gis/db/backends/spatialite/models.py