erlangbureau / jamdb_oracle

Oracle Database driver for Erlang
MIT License
104 stars 48 forks source link

Extracting constraint names #155

Closed dfrese closed 8 months ago

dfrese commented 11 months ago

Constraints are currently not extracted from Oracle-Errors.

in `jamdb_oracle_query.ex':

  def to_constraints(_err, _opts \\ []), do: []

So unique_constraint, no_assoc_constraint, foreign_key_constraint and check_constraint from Ecto.Changeset don't work.

dfrese commented 11 months ago

I implemented something matching the error messages I got from Oracle 19c EE, and will try to make a pull request.

I extracted the names 1:1 as Oracle returns them, which usually does not match the names generated by Ecto: Oracle always adds the Schema/User, and also all uppercase. That's inconvenient, but I did not want to implement something opinionated. At least this works if the constraint names are explicitly given via the name: option to the Ecto.Changeset functions, and optionally match: :suffix.

vstavskyi commented 11 months ago

Check stage branch

Create jamdb_oracle_sql.ex defdelegates