-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Unique index with condition #1029
Comments
Not really, apparently another feature that was PR'd to knex years ago but... Not merged, as always :/ This one even supports all possible drivers and have proper tests 🤷 |
so sad :/ Could you ask me one more question? code:
|
Why would you need a QB there? Its literally just a look up by PK, right? |
I want to do without it,
|
Yes, and I asked why do you think you need QB for that :] |
Looks like conditional indexes might finally be available in Knex since Oct: |
@B4nan Just now running into this exact issue, requiring partial indexes. Since knex now supports partial unique indexes by adding a I have so far solved this with a custom |
You can use index expressions nowadays: @Index({ name: 'custom_index_expr', expression: 'alter table `author` add index `custom_index_expr`(`title`)' })
@Property()
title!: string; |
@B4nan thanks for the follow up - that’s exactly what I ended up doing :) |
Hello I didn't find anything in the documentation, I would like to know if it is possible to create a unique index with condition?
Something like this on the knex:
Entity:
I would like to know if there is any possibility of putting any conditions in my unique index?
The text was updated successfully, but these errors were encountered: