Postgrex error when creating record with AshGeo type

I have a resource which contains an attribute defined as:
attribute :point, AshGeo.Geometry do
description "The underlying PostGIS geometry"
allow_nil? false
constraints geo_types: [Geo.PointZ]
private? true
end
attribute :point, AshGeo.Geometry do
description "The underlying PostGIS geometry"
allow_nil? false
constraints geo_types: [Geo.PointZ]
private? true
end
when I try and run a test which creates a record I get the following error:
** (Postgrex.QueryError) type `geometry` can not be handled by the types module Postgrex.DefaultTypes
** (Postgrex.QueryError) type `geometry` can not be handled by the types module Postgrex.DefaultTypes
I think this is to do with the Postgrex.Types.define added to the runtime.exs not being used in test?
8 Replies
jart
jartOP2y ago
@\ ឵឵឵ any pointers?
\ ឵឵឵
\ ឵឵឵2y ago
Not at my machine at the moment, but at worst you should be able to put the type defs you need in your case template or move them into a def start_phase(:after_start, :normal, _opts) in your application.
jart
jartOP2y ago
nvm I figured it out. there's a big arse if Mix.env() == :prod at the top of runtime.exs :/
\ ឵឵឵
\ ឵឵឵2y ago
Yeah tbh I was wondering 😄
jart
jartOP2y ago
thanks anyway my dude 🙂
ZachDaniel
ZachDaniel2y ago
Did you follow this step? https://hexdocs.pm/ash_geo/readme.html#config-runtime-exs Nvm it was answered I didnt see this
jart
jartOP2y ago
I can't seem to mark this as solved :/
ZachDaniel
ZachDaniel2y ago
should be able to right click and mark it solved I just did it though

Did you find this page helpful?