Skip to content

Commit

Permalink
Sqlite Migrations: Handle Z and M in spatial columns
Browse files Browse the repository at this point in the history
Fixes #14257 (comment)
  • Loading branch information
bricelam committed Nov 19, 2020
1 parent a987c6a commit e117734
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,37 @@ private static readonly HashSet<string> _spatialiteTypes
= new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"GEOMETRY",
"GEOMETRYZ",
"GEOMETRYM",
"GEOMETRYZM",
"GEOMETRYCOLLECTION",
"GEOMETRYCOLLECTIONZ",
"GEOMETRYCOLLECTIONM",
"GEOMETRYCOLLECTIONZM",
"LINESTRING",
"LINESTRINGZ",
"LINESTRINGM",
"LINESTRINGZM",
"MULTILINESTRING",
"MULTILINESTRINGZ",
"MULTILINESTRINGM",
"MULTILINESTRINGZM",
"MULTIPOINT",
"MULTIPOINTZ",
"MULTIPOINTM",
"MULTIPOINTZM",
"MULTIPOLYGON",
"MULTIPOLYGONZ",
"MULTIPOLYGONM",
"MULTIPOLYGONZM",
"POINT",
"POLYGON"
"POINTZ",
"POINTM",
"POINTZM",
"POLYGON",
"POLYGONZ",
"POLYGONM",
"POLYGONZM"
};

private const string IntegerTypeName = "INTEGER";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,25 @@ public override void AddColumnOperation_with_unicode_overridden()
");
}

[ConditionalFact]
public virtual void AddColumnOperation_with_spatial_type()
{
Generate(
new AddColumnOperation
{
Table = "Geometries",
Name = "Geometry",
[SqliteAnnotationNames.Srid] = 4326,
ColumnType = "GEOMETRYZM",
IsNullable = true
});

AssertSql(
@"SELECT AddGeometryColumn('Geometries', 'Geometry', 4326, 'GEOMETRYZM', -1, 0);
");
}


[ConditionalFact]
public void DropSchemaOperation_is_ignored()
{
Expand Down

0 comments on commit e117734

Please sign in to comment.