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

inList check constraints are missing! #1073

Open
3 of 4 tasks
aadrian opened this issue Mar 19, 2018 · 3 comments
Open
3 of 4 tasks

inList check constraints are missing! #1073

aadrian opened this issue Mar 19, 2018 · 3 comments

Comments

@aadrian
Copy link

aadrian commented Mar 19, 2018

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

For inList fields the check constraints seem to be missing:

but the generated DDL https://github.com/aadrian/fieldbugs1/blob/master/ddl.sql does not contain constraints on those fields (only a size limitation)

Expected Behaviour

schema-export (and all dbCreate modes except 'none') should make use of the check constraints, i.e. the generated DB should have them, and when starting an application with dbCreate=validate should warn/error that they're missing (like in the case of other mapping differences).

Actual Behaviour

No check constraints are being used, nor any warning/error is being displayed for dbCreate=validate.

Environment Information

  • Operating System: OSX, Linux, Win 7,8,10
  • GORM Version: 6.1.9
  • Grails Version (if using Grails): 3.3.3
  • JDK Version: 1.8.0_162

Example Application

https://github.com/aadrian/fieldbugs1/

Thank you.

@jameskleeh
Copy link
Contributor

I don't think it's possible to create database level constraints to deal with inList

@aadrian
Copy link
Author

aadrian commented Mar 19, 2018

@jameskleeh why not?

ALTER TABLE <table>
ADD CONSTRAINT chk_val CHECK (col in ('yes','no','maybe'))

is widely supported.

@jameskleeh
Copy link
Contributor

@aadrian I wasn't aware of check constraints. Thanks for letting me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants