Stopped deleting from the geometry_columns view on PostGIS
On PostGIS < 2, geometry_columns is a table that was manually maintained. It's a view on PostGIS 2.
This commit is contained in:
parent
631ef6b272
commit
9715b99f91
|
@ -9,9 +9,8 @@ from django.utils.encoding import python_2_unicode_compatible
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class PostGISGeometryColumns(models.Model):
|
class PostGISGeometryColumns(models.Model):
|
||||||
"""
|
"""
|
||||||
The 'geometry_columns' table from the PostGIS. See the PostGIS
|
The 'geometry_columns' view from PostGIS. See the PostGIS
|
||||||
documentation at Ch. 4.3.2.
|
documentation at Ch. 4.3.2.
|
||||||
On PostGIS 2, this is a view.
|
|
||||||
"""
|
"""
|
||||||
f_table_catalog = models.CharField(max_length=256)
|
f_table_catalog = models.CharField(max_length=256)
|
||||||
f_table_schema = models.CharField(max_length=256)
|
f_table_schema = models.CharField(max_length=256)
|
||||||
|
|
|
@ -7,7 +7,6 @@ class PostGISSchemaEditor(DatabaseSchemaEditor):
|
||||||
rast_index_wrapper = 'ST_ConvexHull(%s)'
|
rast_index_wrapper = 'ST_ConvexHull(%s)'
|
||||||
|
|
||||||
sql_add_spatial_index = "CREATE INDEX %(index)s ON %(table)s USING %(index_type)s (%(column)s %(ops)s)"
|
sql_add_spatial_index = "CREATE INDEX %(index)s ON %(table)s USING %(index_type)s (%(column)s %(ops)s)"
|
||||||
sql_clear_geometry_columns = "DELETE FROM geometry_columns WHERE f_table_name = %(table)s"
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(PostGISSchemaEditor, self).__init__(*args, **kwargs)
|
super(PostGISSchemaEditor, self).__init__(*args, **kwargs)
|
||||||
|
@ -59,12 +58,6 @@ class PostGISSchemaEditor(DatabaseSchemaEditor):
|
||||||
self.execute(sql)
|
self.execute(sql)
|
||||||
self.geometry_sql = []
|
self.geometry_sql = []
|
||||||
|
|
||||||
def delete_model(self, model):
|
|
||||||
super(PostGISSchemaEditor, self).delete_model(model)
|
|
||||||
self.execute(self.sql_clear_geometry_columns % {
|
|
||||||
"table": self.geo_quote_name(model._meta.db_table),
|
|
||||||
})
|
|
||||||
|
|
||||||
def add_field(self, model, field):
|
def add_field(self, model, field):
|
||||||
super(PostGISSchemaEditor, self).add_field(model, field)
|
super(PostGISSchemaEditor, self).add_field(model, field)
|
||||||
# Create geometry columns
|
# Create geometry columns
|
||||||
|
|
Loading…
Reference in New Issue