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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for MSSQL unique constraint #4887
Conversation
Can you create a PR for https://github.com/knex/documentation with documentation? |
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.
You can push tests with add another one in mssql.js file (after "test adding unique key" test) and check the generated SQL.
@kibertoad could you point me in the right direction? I'm no TS developer, so not really sure what to look at. |
@kibertoad @OlivierCavadenti are we happy with the argument name |
@mlevit Something more explicitly boolean like |
My only issue is the argument is only usable for MSSQL... so not really sure what the best play here is. Would |
@mlevit We don't do db-specific naming for db-specific parameters. Note in documentation is sufficient |
Documentation updated knex/documentation#373 |
useConstraint seems nice in my opinion, more descriptive. |
Done. |
Thanks ! |
MSSQL supports both unique indexes and unique constraints. One of the issues we found was unique index (current implementation) cannot be used with foreign key relationships. We must use unique constraints instead.
This is all based on issue #4825
I thought I'd give it a go and update the way MSSQL handles
table.unique
. This is my first PR here so please let me know if there's anything missing, which I'm sure there is.I created a new test which seems to work fine 馃