[11.x] Make spatial types consistent #49634
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Spatial Data types was added on Laravel 5.5 via #21056 and had minor chnages on 5.7 and 6.0 (#25323 and #30545). During these years, MySQL, PostgreSQL (via PostGIS), SQLServer and SQLite (via SpatiaLite) databases have better and more stable support for spatial types. This PR make the support for these types consistent across all supported databases, you may also consider this as a behavioral fix in some way!
Notes
AddGeometryColumn()
method after creating the table. So thegeometry
andgeography
types for SQLite on Laravel are kept for backward-compatibility, testing purposes, and consistency.geometry
andgeography
types.Why?
geometry
defaults togeography
which is confusing.point
,line
,lseg
,box
,path
,polygon
, andcircle
), that has conflict with implemented PostGIS types (thepoint
andpolygon
types). This PR fixes this.geometry
and 21 subtypes forgeography
that was impossible to be used on Laravel. The new implementation on this PR fixes this.geography
although SQL Server hasgeometry
type too. This PR fixes that.Changes
geometry
type to acceptsubtype
(defaultnull
) andsrid
(default0
) :null
(i.e.geometry
),point
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
null
,point
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
,linearRing
,polyhedralSurface
,triangle
,tin
,circularString
,compoundCurve
,curvePolygon
,multiCurve
,multiSurface
with added suffixesZ
,M
andZM
.geography
type that acceptssubtype
(defaultnull
) andsrid
(default4326
):null
(i.e.geometry
),point
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
null
,point
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
with added suffixesZ
,M
andZM
.point
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
, andmultiPolygonZ
explicit types.->isGeometry()
and->projection()
modifiers from PostgreSQL.Upgrade guide
Likelihood Of Impact: Low
The
geometry
andgeography
column types of database migrations have been rewritten to make these types consistent across all databases, Therefore, you may removepoint
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
, andmultiPolygonZ
types from your migrations and usegeometry
/geography
types instead: