jhartwell / Plsm

Elixir mix task to generate Ecto models from already existing tables
MIT License
265 stars 54 forks source link

Postgres Mix plsm Output Error Geo Fields? #126

Open chavenor opened 2 years ago

chavenor commented 2 years ago

I'm not sure how to fix this. It seems like there isn't a pattern match for a boolean field.

I'm using Postgres 13.x and have PostGIS enabled. Will it work for geo fields?

Using PostgreSQL...
** (FunctionClauseError) no function clause matching in Plsm.IO.Export.map_type/1

    The following arguments were given to Plsm.IO.Export.map_type/1:

        # 1
        :boolean

    Attempted function clauses (showing 7 out of 7):

        defp map_type(:decimal)
        defp map_type(:float)
        defp map_type(:string)
        defp map_type(:text)
        defp map_type(:map)
        defp map_type(:date)
        defp map_type(:integer)

    lib/io/export.ex:12: Plsm.IO.Export.map_type/1
    lib/io/export.ex:8: Plsm.IO.Export.type_output/1
    lib/io/export.ex:63: anonymous fn/2 in Plsm.IO.Export.prepare/2
    (elixir 1.13.3) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/io/export.ex:62: Plsm.IO.Export.prepare/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    lib/plsm.ex:16: Mix.Tasks.Plsm.run/1
tomjoro commented 2 years ago

Use the latest from GitHub. It has support for Boolean and it works. I see the change here (from 2020): https://github.com/jhartwell/Plsm/commit/cd9b14b72ad28897da677053e1de2c0862fae165

I don't think geo fields are supported - others were asking for it.