-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support other unique constraint error format #115
Support other unique constraint error format #115
Conversation
Unique constraints sometimes fail with the following error format: UNIQUE constraint failed: index '<index_name>' I believe this happens when the index name doesn't match the names of the columns involved. Example of an index for which this happens: CREATE UNIQUE INDEX test_user_id_number_year_index ON invoices (user_id, number, strftime('%Y', created_at));
|
||
test "simple unique index" do | ||
error = %Exqlite.Error{message: "UNIQUE constraint failed: one.two.three"} | ||
assert Connection.to_constraints(error, []) == [unique: "one_two_three_index"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be unique: "one.two.three"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not in my testing.
I've done some more testing and added specific index examples I've used so it can be reproduced / tested against future SQLite versions.
Does it make more sense now?
Thanks for looking at this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH, I was looking at this as trying to extract the one.two.three
portion out of the string, but completely missed that this is missing the index
part of the string.
Released under |
Unique constraints sometimes fail with the following error format:
UNIQUE constraint failed: index '<index_name>'
I believe this happens when the index name doesn't match the names of the columns involved.
Example of an index for which this happens:
Resolves #89