{"action":"created","issue":{"url":"https://api.github.com/repos/yesodweb/persistent/issues/24","labels_url":"https://api.github.com/repos/yesodweb/persistent/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/yesodweb/persistent/issues/24/comments","events_url":"https://api.github.com/repos/yesodweb/persistent/issues/24/events","html_url":"https://github.com/yesodweb/persistent/issues/24","id":1798871,"number":24,"title":"Models that circularly reference each other can not be instantiated by Persistent","user":{"login":"thejerf","id":319248,"avatar_url":"https://avatars.githubusercontent.com/u/319248?v=3","gravatar_id":"","url":"https://api.github.com/users/thejerf","html_url":"https://github.com/thejerf","followers_url":"https://api.github.com/users/thejerf/followers","following_url":"https://api.github.com/users/thejerf/following{/other_user}","gists_url":"https://api.github.com/users/thejerf/gists{/gist_id}","starred_url":"https://api.github.com/users/thejerf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thejerf/subscriptions","organizations_url":"https://api.github.com/users/thejerf/orgs","repos_url":"https://api.github.com/users/thejerf/repos","events_url":"https://api.github.com/users/thejerf/events{/privacy}","received_events_url":"https://api.github.com/users/thejerf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yesodweb/persistent/labels/MySQL","name":"MySQL","color":"bfdadc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2011-10-02T23:41:11Z","updated_at":"2015-05-25T04:14:47Z","closed_at":"2015-05-25T04:14:47Z","body":"The exact manifestation of the errors seem to vary, but the following tends to do \"something bad\":\r\n\r\n    ThingA\r\n        thingb ThingBId Maybe\r\n    ThingB\r\n        thinga ThingAId Maybe\r\n\r\nNote that if the database is already correctly set up everything seems to work, so the workaround is to manually migrate the DB.\r\n\r\nI _think_ it suffices to reorder the steps taken to migrate to:\r\n\r\n1. Remove all no-longer-valid foreign key constraints. (Which I think is done first since this errors out and correctly demands the human do it themselves.)\r\n2. Perform all table structure changes.\r\n3. Add all missing foreign key constraints."},"comment":{"url":"https://api.github.com/repos/yesodweb/persistent/issues/comments/105118602","html_url":"https://github.com/yesodweb/persistent/issues/24#issuecomment-105118602","issue_url":"https://api.github.com/repos/yesodweb/persistent/issues/24","id":105118602,"user":{"login":"gregwebs","id":1183,"avatar_url":"https://avatars.githubusercontent.com/u/1183?v=3","gravatar_id":"","url":"https://api.github.com/users/gregwebs","html_url":"https://github.com/gregwebs","followers_url":"https://api.github.com/users/gregwebs/followers","following_url":"https://api.github.com/users/gregwebs/following{/other_user}","gists_url":"https://api.github.com/users/gregwebs/gists{/gist_id}","starred_url":"https://api.github.com/users/gregwebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregwebs/subscriptions","organizations_url":"https://api.github.com/users/gregwebs/orgs","repos_url":"https://api.github.com/users/gregwebs/repos","events_url":"https://api.github.com/users/gregwebs/events{/privacy}","received_events_url":"https://api.github.com/users/gregwebs/received_events","type":"User","site_admin":false},"created_at":"2015-05-25T04:14:47Z","updated_at":"2015-05-25T04:14:47Z","body":"Yes, seems to be working now. Thanks for investigating"}}