{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/doc/issues/176","labels_url":"https://api.github.com/repos/sequelize/doc/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/doc/issues/176/comments","events_url":"https://api.github.com/repos/sequelize/doc/issues/176/events","html_url":"https://github.com/sequelize/doc/issues/176","id":91005457,"number":176,"title":"Specifying associations via migrations","user":{"login":"jonlambert","id":856225,"avatar_url":"https://avatars.githubusercontent.com/u/856225?v=3","gravatar_id":"","url":"https://api.github.com/users/jonlambert","html_url":"https://github.com/jonlambert","followers_url":"https://api.github.com/users/jonlambert/followers","following_url":"https://api.github.com/users/jonlambert/following{/other_user}","gists_url":"https://api.github.com/users/jonlambert/gists{/gist_id}","starred_url":"https://api.github.com/users/jonlambert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonlambert/subscriptions","organizations_url":"https://api.github.com/users/jonlambert/orgs","repos_url":"https://api.github.com/users/jonlambert/repos","events_url":"https://api.github.com/users/jonlambert/events{/privacy}","received_events_url":"https://api.github.com/users/jonlambert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-25T16:05:04Z","updated_at":"2015-06-25T18:18:42Z","closed_at":null,"body":"When defining a migration, how can I specify a relationship to another Model (thus creating the valid foreign keys)?\r\n\r\nThere's plenty of documentation for adding this via .sync(), but none that I can find for adding via migrations."},"comment":{"url":"https://api.github.com/repos/sequelize/doc/issues/comments/115352524","html_url":"https://github.com/sequelize/doc/issues/176#issuecomment-115352524","issue_url":"https://api.github.com/repos/sequelize/doc/issues/176","id":115352524,"user":{"login":"jonlambert","id":856225,"avatar_url":"https://avatars.githubusercontent.com/u/856225?v=3","gravatar_id":"","url":"https://api.github.com/users/jonlambert","html_url":"https://github.com/jonlambert","followers_url":"https://api.github.com/users/jonlambert/followers","following_url":"https://api.github.com/users/jonlambert/following{/other_user}","gists_url":"https://api.github.com/users/jonlambert/gists{/gist_id}","starred_url":"https://api.github.com/users/jonlambert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonlambert/subscriptions","organizations_url":"https://api.github.com/users/jonlambert/orgs","repos_url":"https://api.github.com/users/jonlambert/repos","events_url":"https://api.github.com/users/jonlambert/events{/privacy}","received_events_url":"https://api.github.com/users/jonlambert/received_events","type":"User","site_admin":false},"created_at":"2015-06-25T18:18:42Z","updated_at":"2015-06-25T18:18:42Z","body":"Absolutely, agreed. However, what I'm looking to do is add a relationship in the same way as the models do - with foreign keys etc. There is no documentation on how to re-create the database structure generated by the Models API in a migration."}}