{"action":"opened","issue":{"url":"https://api.github.com/repos/nodes-vapor/sourcery-templates/issues/10","repository_url":"https://api.github.com/repos/nodes-vapor/sourcery-templates","labels_url":"https://api.github.com/repos/nodes-vapor/sourcery-templates/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/nodes-vapor/sourcery-templates/issues/10/comments","events_url":"https://api.github.com/repos/nodes-vapor/sourcery-templates/issues/10/events","html_url":"https://github.com/nodes-vapor/sourcery-templates/issues/10","id":262701988,"number":10,"title":"Automatically create relations","user":{"login":"steffendsommer","id":685672,"avatar_url":"https://avatars2.githubusercontent.com/u/685672?v=4","gravatar_id":"","url":"https://api.github.com/users/steffendsommer","html_url":"https://github.com/steffendsommer","followers_url":"https://api.github.com/users/steffendsommer/followers","following_url":"https://api.github.com/users/steffendsommer/following{/other_user}","gists_url":"https://api.github.com/users/steffendsommer/gists{/gist_id}","starred_url":"https://api.github.com/users/steffendsommer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steffendsommer/subscriptions","organizations_url":"https://api.github.com/users/steffendsommer/orgs","repos_url":"https://api.github.com/users/steffendsommer/repos","events_url":"https://api.github.com/users/steffendsommer/events{/privacy}","received_events_url":"https://api.github.com/users/steffendsommer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-04T08:15:30Z","updated_at":"2017-10-04T08:15:30Z","closed_at":null,"author_association":"OWNER","body":"Since we're already annotating relations, I think it makes sense to have Sourcery create relations. E.g. in the case of (inside `Employee.swift`):\n\n```\n// sourcery: preparation = foreignId, unique = false, foreignTable = Company\ninternal var companyId: Identifier?\n```\n\nThen it could create an extension on `Employee` with a property called `company` which would return the parent. Similarly it could create an extension on `Company` with a property called `employees` which would return the children.\n\nWe could consider if it makes sense to have an annotation to indicate 1-1 relations so instead of returning all the children it would return the first children."}}
{"actor":{"display_login":"steffendsommer"}}