gjaldon / ecto_enum

Ecto extension to support enums in models
MIT License
563 stars 131 forks source link

Add function for checking if EctoEnum types match with Postgresql types #80

Open gjaldon opened 5 years ago

gjaldon commented 5 years ago

Request from https://elixirforum.com/t/ectoenum-ecto-extension-to-support-enums-in-ecto-models/23440/2?u=gjaldon:

Would it be possible to have a function that we can call that checks the postgresql database’s Enum definition and makes sure it matches the defenum definition, and if there are any inconsistencies then it would return back, say, a {:error, reason} where reason is a list of the inconsistencies so we can log it or error or whatever we want (in addition to other reason codes like the Repo passed in is failing or something, :ok means successful and everything matches)?

I have to match to a pre-existing type of a backend database so I’d like to make sure I stay in sync, especially as it updates (been bit once by this). ^.^