annotate_models
annotate_models copied to clipboard
Column wrongly mistaken as a geometric point
We have postgis for geometric data, and our geometric columns are annotated correctly, e.g.:
# coordinates :geography not null, point, 4326
However, we have some enum types that was created after we installed postgis, and these are annotated weirdly:
# category :enum not null, point, 0
Notice the point, 0
This is the postgres column:
category public.point_of_interest_category NOT NULL,
(point_of_interest_category
is an enum type)
When introspecting the column in active record I get:
PointOfInterest.columns.find{_1.name == "category"}
=>
#<ActiveRecord::ConnectionAdapters::PostGIS::SpatialColumn:0x00007f5c2a45ae60
@collation=nil,
@comment=nil,
@default=nil,
@default_function=nil,
@generated="",
@geographic=false,
@geometric_type=RGeo::Feature::Point,
@has_m=false,
@has_z=false,
@name="category",
@null=false,
@serial=nil,
@sql_type_metadata=
#<ActiveRecord::ConnectionAdapters::SqlTypeMetadata:0x00007f5c2a45b130
@limit=nil,
@precision=nil,
@scale=nil,
@sql_type="point_of_interest_category",
@type=:enum>,
@srid=0>
Notice that it has geographic: false
, but it also has a geometric_type
. I'm not sure, but I think in this case, it should not be treated as a geometry in annotate?
(I'm not sure if the problem is in annotate or in the postgis adapter)
Commands
Running annotate as part of migrate
Version
- annotate version: 3.2.0
- rails version: 7.0.4.1
- ruby version: 3.1.3