{"action":"created","issue":{"url":"https://api.github.com/repos/grails/grails-core/issues/10052","repository_url":"https://api.github.com/repos/grails/grails-core","labels_url":"https://api.github.com/repos/grails/grails-core/issues/10052/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-core/issues/10052/comments","events_url":"https://api.github.com/repos/grails/grails-core/issues/10052/events","html_url":"https://github.com/grails/grails-core/issues/10052","id":166301536,"number":10052,"title":"importFrom constraints are not respected at schema generation","user":{"login":"andreasschiestl","id":8170218,"avatar_url":"https://avatars.githubusercontent.com/u/8170218?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasschiestl","html_url":"https://github.com/andreasschiestl","followers_url":"https://api.github.com/users/andreasschiestl/followers","following_url":"https://api.github.com/users/andreasschiestl/following{/other_user}","gists_url":"https://api.github.com/users/andreasschiestl/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasschiestl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasschiestl/subscriptions","organizations_url":"https://api.github.com/users/andreasschiestl/orgs","repos_url":"https://api.github.com/users/andreasschiestl/repos","events_url":"https://api.github.com/users/andreasschiestl/events{/privacy}","received_events_url":"https://api.github.com/users/andreasschiestl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/grails/grails-core/labels/GORM","name":"GORM","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"assignees":[{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/grails/grails-core/milestones/180","html_url":"https://github.com/grails/grails-core/milestones/grails-3.2.2","labels_url":"https://api.github.com/repos/grails/grails-core/milestones/180/labels","id":2061804,"number":180,"title":"grails-3.2.2","description":"","creator":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":9,"state":"open","created_at":"2016-10-11T10:09:21Z","updated_at":"2016-10-24T10:41:25Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2016-07-19T10:47:44Z","updated_at":"2016-10-24T10:48:28Z","closed_at":"2016-10-21T07:26:31Z","body":"If you use the `importFrom` feature (http://docs.grails.org/latest/ref/Constraints/Usage.html) to share constraints between domain classes these contraints (like nullable, maxSize, etc.) are not respected for the schema generation.\r\n\r\nMaybe the `shared` feature is also affected, I don't use this feature.\r\n\r\n### Steps to Reproduce\r\n\r\n1. Create a domain with constraints that effect the schema generation\r\n```\r\nclass TestB {\r\n\r\n    String name\r\n\r\n    static constraints = {\r\n        name (nullable: true, maxSize: 150)\r\n    }\r\n}\r\n```\r\n\r\n2. Create a domain that shares constraints with `importFrom`\r\n```\r\nclass TestA {\r\n\r\n    String name\r\n\r\n    static constraints = {\r\n        importFrom(TestB)\r\n    }\r\n}\r\n```\r\n3. run `schema-export`\r\n\r\n\r\n### Expected Behaviour\r\nschema-export generates (maxSize and nullable respected)\r\n```\r\n    create table testa (\r\n        id bigint not null auto_increment,\r\n        version bigint not null,\r\n        name varchar(150),\r\n        primary key (id)\r\n    );\r\n```\r\n\r\n### Actual Behaviour\r\nschema-export generates (maxSize and nullable NOT respected)\r\n```\r\ncreate table testa (\r\n        id bigint not null auto_increment,\r\n        version bigint not null,\r\n        name varchar(255) not null,\r\n        primary key (id)\r\n    );\r\n```\r\n\r\n### Environment Information\r\n\r\n- **Operating System**: Mac OS X 10.11.5\r\n- **Grails Version:** 3.1.9\r\n- **JDK Version:**  1.8.0_72\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/grails/grails-core/issues/comments/255708156","html_url":"https://github.com/grails/grails-core/issues/10052#issuecomment-255708156","issue_url":"https://api.github.com/repos/grails/grails-core/issues/10052","id":255708156,"user":{"login":"andreasschiestl","id":8170218,"avatar_url":"https://avatars.githubusercontent.com/u/8170218?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasschiestl","html_url":"https://github.com/andreasschiestl","followers_url":"https://api.github.com/users/andreasschiestl/followers","following_url":"https://api.github.com/users/andreasschiestl/following{/other_user}","gists_url":"https://api.github.com/users/andreasschiestl/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasschiestl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasschiestl/subscriptions","organizations_url":"https://api.github.com/users/andreasschiestl/orgs","repos_url":"https://api.github.com/users/andreasschiestl/repos","events_url":"https://api.github.com/users/andreasschiestl/events{/privacy}","received_events_url":"https://api.github.com/users/andreasschiestl/received_events","type":"User","site_admin":false},"created_at":"2016-10-24T10:48:28Z","updated_at":"2016-10-24T10:48:28Z","body":"we managed to get the constraints out of the script and tested our code with the 3.2.2 snapshot version. the constraints now work as expected, but unfortunately the app crashes sometimes at the start. We will wait for the final 3.2.2 release and create an issue if the problem still exists."}}
{"actor":{"display_login":"andreasschiestl"}}