-
Notifications
You must be signed in to change notification settings - Fork 136
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 constraint on multiple columns #63
Conversation
wowowowow. This looks super exciting. Thanks! Actually I just posted some thoughts and was hoping for one pull request because this is certainly out of my scope.... And suddenly, boom, there you are. btw, how does the master branch handles possible different on conflict constrains in the multiple primary keys case? |
1f3cef7
to
5e8e411
Compare
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.
Thanks for the contribution! I just have two small changes I'd like to make :)
*/ | ||
@Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) | ||
public @interface Constraints { | ||
UniqueConstraint[] value(); |
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.
What do you think about naming this unique instead of value? Then after this change is merged we can add the other table constraints.
|
||
/** Adds the UNIQUE constraint on a table level */ | ||
@Retention(CLASS) @Target(TYPE) | ||
public @interface UniqueConstraint { |
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.
Please add an optional constraint name.
Done. Please, take another look. Let me know if I need to squash commits. |
Looks good, please squash and I'll get it merged :) |
aae99a5
to
d778102
Compare
squashed |
Thanks! |
Addresses issue #54
Two ways to specify unique constraint on table level
or
The last one allows to specify multiple unique constraints.
Full example. Table definition:
The generated code will looks like: