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

Feature request make is_unique - more than one field. #1655

Closed
nowackipawel opened this issue Jan 8, 2019 · 2 comments
Closed

Feature request make is_unique - more than one field. #1655

nowackipawel opened this issue Jan 8, 2019 · 2 comments

Comments

@nowackipawel
Copy link
Contributor

nowackipawel commented Jan 8, 2019

As for now is_unique supports only one column like this:

is_unique[t_handbook_subject.hsu_slug,hsu_id,{hsu_id}]

it will be great if we will be able to support sth like this:

is_unique[t_handbook_subject.hsu_slug,hsu_id#hsu_lang,{hsu_id#hsu_lang}]
or at least sth like this:
is_unique[t_handbook_subject.hsu_slug,CONCAT(`hsu_id`,'#',`hsu_lang`),{hsu_id#hsu_lang}]

... for tables where unique keys contains more than one field.

I know that this first idea how to do this is not smart enough... but i didn't think how to realize it in a good way yet.

Required changes:

  • passing entire row to is_unique method,
  • parsing is_unique rule.
@bangbangda
Copy link
Contributor

I think using Creating Custom Rules will solve your problem better.

@lonnieezell
Copy link
Member

That becomes way too complex a function at that point. I agree that a custom rule is a better solution here, or simply a custom check in the model or wherever.

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

No branches or pull requests

3 participants