{"action":"created","issue":{"url":"https://api.github.com/repos/coleifer/peewee/issues/1516","repository_url":"https://api.github.com/repos/coleifer/peewee","labels_url":"https://api.github.com/repos/coleifer/peewee/issues/1516/labels{/name}","comments_url":"https://api.github.com/repos/coleifer/peewee/issues/1516/comments","events_url":"https://api.github.com/repos/coleifer/peewee/issues/1516/events","html_url":"https://github.com/coleifer/peewee/issues/1516","id":300074860,"number":1516,"title":"Peewee+PSQL: create_tables for complex object relationships broken when DeferredRelations in play","user":{"login":"josefdlange","id":1062835,"avatar_url":"https://avatars1.githubusercontent.com/u/1062835?v=4","gravatar_id":"","url":"https://api.github.com/users/josefdlange","html_url":"https://github.com/josefdlange","followers_url":"https://api.github.com/users/josefdlange/followers","following_url":"https://api.github.com/users/josefdlange/following{/other_user}","gists_url":"https://api.github.com/users/josefdlange/gists{/gist_id}","starred_url":"https://api.github.com/users/josefdlange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josefdlange/subscriptions","organizations_url":"https://api.github.com/users/josefdlange/orgs","repos_url":"https://api.github.com/users/josefdlange/repos","events_url":"https://api.github.com/users/josefdlange/events{/privacy}","received_events_url":"https://api.github.com/users/josefdlange/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-25T23:58:34Z","updated_at":"2018-02-26T23:23:30Z","closed_at":"2018-02-26T15:53:04Z","author_association":"CONTRIBUTOR","body":"As in the docs, circular FK dependencies are a code smell, and I agree, but here we are. I've got a big object domain with some of these objects having circular foreign keys.\r\n\r\nIn `peewee` versions in the 2.8 line, `create_tables` seemed to be able to resolve any `DeferredRelation`s used for circular FK relationships and tell PSQL to create the tables appropriately. I see in the [docs](http://docs.peewee-orm.com/en/2.10.2/peewee/models.html#circular-foreign-key-dependencies) that there's a more manual approach documented, but I've never encountered need for it until upgrading from 2.8.x to 2.10.x.\r\n\r\nTwo questions:\r\n\r\n1) Am I correct in finding that the behavior of automatically doing this was done by `peewee` prior, and is now no longer supported? (otherwise, what magic could it have been that made this work before?)\r\n2) Do you have any recommended methods for enabling a more opinionated methodology to creating tables in this way, or automating the process as documented? My CI environment does a build/teardown of tables every run (sometimes every test) and I'm thinking that having a special codepath for each `DeferredRelation`'s setup is a little unclean.\r\n\r\nI know it's a way uncommon use-case (and a noncurrent version on top of that), but I'm hoping you might have some top-of-the-head insight as to what in particular changed; the changelog between the versions don't really show anything that appears related.\r\n\r\nAs always, thanks for your continued work and support on this tool -- it's a wonderful piece of tech."},"comment":{"url":"https://api.github.com/repos/coleifer/peewee/issues/comments/368687550","html_url":"https://github.com/coleifer/peewee/issues/1516#issuecomment-368687550","issue_url":"https://api.github.com/repos/coleifer/peewee/issues/1516","id":368687550,"user":{"login":"josefdlange","id":1062835,"avatar_url":"https://avatars1.githubusercontent.com/u/1062835?v=4","gravatar_id":"","url":"https://api.github.com/users/josefdlange","html_url":"https://github.com/josefdlange","followers_url":"https://api.github.com/users/josefdlange/followers","following_url":"https://api.github.com/users/josefdlange/following{/other_user}","gists_url":"https://api.github.com/users/josefdlange/gists{/gist_id}","starred_url":"https://api.github.com/users/josefdlange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josefdlange/subscriptions","organizations_url":"https://api.github.com/users/josefdlange/orgs","repos_url":"https://api.github.com/users/josefdlange/repos","events_url":"https://api.github.com/users/josefdlange/events{/privacy}","received_events_url":"https://api.github.com/users/josefdlange/received_events","type":"User","site_admin":false},"created_at":"2018-02-26T23:23:30Z","updated_at":"2018-02-26T23:23:30Z","author_association":"CONTRIBUTOR","body":"My goodness you're fantastic. Thanks for the quick turnaround and thoughts. Any thoughts as to why it was just working before? \r\n\r\nI was using the `test_database` context manager / decorator from `playhouse` which in turn uses `create_model_tables`. It hadn't had any problems or complaints until I upgraded from `2.8.0` (woah, just realized how far behind I'd been; that's like 2 years!) just recently."}}
{"actor":{"display_login":"josefdlange"}}