Ticket #23030: spatialite_migrations_fix.patch
File spatialite_migrations_fix.patch, 1.2 KB (added by , 10 years ago) |
---|
-
django/contrib/gis/db/backends/spatialite/schema.py
a b 6 6 sql_add_spatial_index = "SELECT CreateSpatialIndex(%(table)s, %(column)s)" 7 7 sql_drop_spatial_index = "DROP TABLE idx_%(table)s_%(column)s" 8 8 sql_remove_geometry_metadata = "SELECT DiscardGeometryColumn(%(table)s, %(column)s)" 9 sql_update_geometry_columns = "UPDATE geometry_columns SET f_table_name = %(new_table)s WHERE f_table_name = %(old_table)s"10 9 11 10 def __init__(self, *args, **kwargs): 12 11 super(SpatialiteSchemaEditor, self).__init__(*args, **kwargs) … … 86 85 if isinstance(field, GeometryField): 87 86 self.remove_geometry_metadata(model, field) 88 87 super(SpatialiteSchemaEditor, self).remove_field(model, field) 89 90 def alter_db_table(self, model, old_db_table, new_db_table):91 super(SpatialiteSchemaEditor, self).alter_db_table(model, old_db_table, new_db_table)92 self.execute(93 self.sql_update_geometry_columns % {94 "old_table": self.quote_name(old_db_table),95 "new_table": self.quote_name(new_db_table),96 }97 )