pepsico-ecommerce / snowflex

elixir snowflake client
Apache License 2.0
52 stars 10 forks source link

chore: use Ecto.Type.type to determine db type #81

Closed BruceBC closed 3 months ago

BruceBC commented 3 months ago

Context

ecto release v1.12.1 introduced a change to the way mappings were return for Ecto.Enum.mappings/2.

We were relying on this mapping to convert Ecto.Enum to :string when creating the database columns.

See https://github.com/elixir-ecto/ecto/commit/21c6068c9c829df13f4cb577cbd53263b4950262#diff-025069044568b480ef6f86f025cb46a7064695e6df1e7008ede689e09a9c7836L317-R318

Decision

To make this more future proof, use Ecto.Type.type/1 to handle schema type to database type conversions.


chore: fix single-quoted warning

Context

warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 256 │   defp insert_all_value(_), do: '?'
     │                                 ~
     │
     └─ lib/snowflex/ecto/connection.ex:256:33

     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 601 │     '?'
     │     ~
     │
     └─ lib/snowflex/ecto/connection.ex:601:5
PM-Pepsico commented 3 months ago

Very nice! I like it. I wasn't sure if we would want a version bump in the mix.exs but it looks like Ecto.Type.type has been in since at least 3.0.0.