Skip to content
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

feat: support partial unique indexes #5316

Merged
merged 2 commits into from Sep 1, 2022

Conversation

abalabahaha
Copy link
Contributor

@abalabahaha abalabahaha commented Aug 31, 2022

Adds MSSQL, PostgreSQL, and SQLite support for partial unique indexes, heavily based on #4768.

The Postgres driver defaults to creating a unique constraint instead of an index, so Postgres support for useConstraint was added, defaulting to true without predicate and false with predicate. The alternative would be to always default to useConstraint: true, but then predicate would error by default unless useConstraint: false is explicitly specified. Dunno which is better.

Docs: knex/documentation#449

Fixes #4870

@coveralls
Copy link

coveralls commented Aug 31, 2022

Coverage Status

Coverage increased (+0.05%) to 92.323% when pulling 60da980 on abalabahaha:feat/partial-unique into 57692d3 on knex:master.

@kibertoad
Copy link
Collaborator

@abalabahaha unit tests are failing

@abalabahaha
Copy link
Contributor Author

@kibertoad sorry about that, I must have missed those since random tests were timing out on my computer. I fixed the failed tests

@kibertoad kibertoad merged commit 864530c into knex:master Sep 1, 2022
@enchorb
Copy link

enchorb commented Dec 17, 2022

Any idea when this will be released?

@kibertoad
Copy link
Collaborator

This was released in 2.4.0, sorry for the delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: partial index inside unique method
4 participants