-
Notifications
You must be signed in to change notification settings - Fork 60
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 for conditional index #353
Comments
How many databases support this? Just Postgres and SQL Server? |
Yep, those two and SQLite |
It can be easily and safely emulated by transforming the index to a unique one I.e. |
Mmmmm. So look, every database has a bunch of fancy proprietary options for creating indexes. We can't possibly expand the Now, perhaps it could make sense to add something like @Index(name="orders_unbilled_index ",
columnList="order_nr",
indexDefinition ="where billed is not true") To produce this DDL: create index orders_unbilled_index on orders (order_nr)
where billed is not true; And of course you could also use it for lots of other things. I guess that's kinda intellectually consistent at least. On the other hand, you could just put that Dunno. [Note: I wrote this before seeing @beikov's comment.] |
Ah, that's interesting. |
Thank you for the suggestion, though still trying to add that option since it seems more like an elegant solution, for the relevant databases, IMO. |
Looks awsome. |
@carmi2214 We need to pick just one of those alternatives. You can't have both 😅 |
Of course - excuse me, by "awsome" I meant to respond on the |
Actually, since the So perhaps what we should do is call it Index(name = "orders_unbilled_index ",
columnList = "order_nr",
options = "where billed is not true") We could even add I think this would be a quite useful enhancement. |
@gavinking Great! So, what's next? |
So your nagging worked: #485. But now lets see what other people think. |
Hi, I think it would be very useful to add in
Index.java
a property calledcondition
/where
, to use in DB types that support the feature.For example:
Useful for indicies on tables with logical deletion, or many other cases
The text was updated successfully, but these errors were encountered: