{"action":"created","issue":{"url":"https://api.github.com/repos/diesel-rs/diesel/issues/529","repository_url":"https://api.github.com/repos/diesel-rs/diesel","labels_url":"https://api.github.com/repos/diesel-rs/diesel/issues/529/labels{/name}","comments_url":"https://api.github.com/repos/diesel-rs/diesel/issues/529/comments","events_url":"https://api.github.com/repos/diesel-rs/diesel/issues/529/events","html_url":"https://github.com/diesel-rs/diesel/pull/529","id":193778518,"number":529,"title":"Load custom schemas from `infer_schema!`","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-12-06T13:57:05Z","updated_at":"2016-12-07T13:15:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/diesel-rs/diesel/pulls/529","html_url":"https://github.com/diesel-rs/diesel/pull/529","diff_url":"https://github.com/diesel-rs/diesel/pull/529.diff","patch_url":"https://github.com/diesel-rs/diesel/pull/529.patch"},"body":"This changes `infer_table_from_schema!` to optionally take a custom\r\nschema in the form `schema_name.table_name`, and generate different code\r\naccordingly. `infer_schema!` will now load the names of all custom\r\nschemas, and generate the code accordingly. Any schemas other than the\r\ndefault will be wrapped in a module.\r\n\r\nUnresolved Questions\r\n--------------------\r\n\r\nOn basically every backend other than PG, the term \"schema\" is\r\ninterchangeable with \"database\". We almost certainly never want to load\r\nthe schemas for other databases by default. Instead of automatically\r\npicking up the schema names, should we instead require that the schema\r\nname be passed to `infer_schema!`? That would mean it looks something\r\nlike:\r\n\r\n```rust\r\ninfer_schema!(\"dotenv:DATABASE_URL\");\r\ninfer_schema!(\"dotenv:DATABASE_URL\", \"custom_schema\");\r\n```\r\n\r\nFixes #447."},"comment":{"url":"https://api.github.com/repos/diesel-rs/diesel/issues/comments/265444328","html_url":"https://github.com/diesel-rs/diesel/pull/529#issuecomment-265444328","issue_url":"https://api.github.com/repos/diesel-rs/diesel/issues/529","id":265444328,"user":{"login":"killercup","id":20063,"avatar_url":"https://avatars.githubusercontent.com/u/20063?v=3","gravatar_id":"","url":"https://api.github.com/users/killercup","html_url":"https://github.com/killercup","followers_url":"https://api.github.com/users/killercup/followers","following_url":"https://api.github.com/users/killercup/following{/other_user}","gists_url":"https://api.github.com/users/killercup/gists{/gist_id}","starred_url":"https://api.github.com/users/killercup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killercup/subscriptions","organizations_url":"https://api.github.com/users/killercup/orgs","repos_url":"https://api.github.com/users/killercup/repos","events_url":"https://api.github.com/users/killercup/events{/privacy}","received_events_url":"https://api.github.com/users/killercup/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T13:15:55Z","updated_at":"2016-12-07T13:15:55Z","body":"> and the database name appears where the schema name appears in PG\r\n\r\nDamn, that *is* unfortunate. So that means implementing schema inference with custom schemas gives up… multiple dbs in MySQL? Crazy.\r\n\r\nSo, the options are to (a) not try to load all the custom schemas automatially or (b) special-case this for pg and tell people why that is. I say, go with option (a) and make people type their custom schemas' names so they know they will get them.\r\n\r\n> Unfortunately, if we want to be able to use macros 1.1, we can only take string literals as arguments.\r\n\r\nCan you do `($database_url:expr, $schema:indent)` and expand to `#[options(database_url=strigify!($schema))]` so users can only supply something that can become a module name? \r\n"}}
{"actor":{"display_login":"killercup"}}