{"action":"created","issue":{"url":"https://api.github.com/repos/ankane/multiverse/issues/21","repository_url":"https://api.github.com/repos/ankane/multiverse","labels_url":"https://api.github.com/repos/ankane/multiverse/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/ankane/multiverse/issues/21/comments","events_url":"https://api.github.com/repos/ankane/multiverse/issues/21/events","html_url":"https://github.com/ankane/multiverse/issues/21","id":367337595,"node_id":"MDU6SXNzdWUzNjczMzc1OTU=","number":21,"title":"Schema Caching from schema_cache.yml dump does not seem to work","user":{"login":"a-maas","id":7715395,"node_id":"MDQ6VXNlcjc3MTUzOTU=","avatar_url":"https://avatars3.githubusercontent.com/u/7715395?v=4","gravatar_id":"","url":"https://api.github.com/users/a-maas","html_url":"https://github.com/a-maas","followers_url":"https://api.github.com/users/a-maas/followers","following_url":"https://api.github.com/users/a-maas/following{/other_user}","gists_url":"https://api.github.com/users/a-maas/gists{/gist_id}","starred_url":"https://api.github.com/users/a-maas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-maas/subscriptions","organizations_url":"https://api.github.com/users/a-maas/orgs","repos_url":"https://api.github.com/users/a-maas/repos","events_url":"https://api.github.com/users/a-maas/events{/privacy}","received_events_url":"https://api.github.com/users/a-maas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-05T19:23:23Z","updated_at":"2018-10-05T19:54:27Z","closed_at":null,"author_association":"NONE","body":"With Rails 5, I'm using `rails db:schema:cache:dump` to generate `db/schema_cache.yml` files, which pre-caches your schema in a yml file. This is working properly on my main database. The database task to generate the files is working properly for my 2nd database, generating a `db/second/schema_cache.yml`, but this file isn't loaded by the schema cache railtie, I think, because it calls `first`: \r\n\r\n```ruby\r\nFile.join(app.config.paths[\"db\"].first, \"schema_cache.yml\")\r\n```\r\nHere's the line: https://github.com/rails/rails/blob/v5.2.1/activerecord/lib/active_record/railtie.rb#L91.\r\n\r\nI wanted to see if anyone who contributes to multiverse had any suggestions on how to get schema caching working for additional databases. I'd be happy to try to put a PR together, but would need some help determining the correct path forward.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ankane/multiverse/issues/comments/427480892","html_url":"https://github.com/ankane/multiverse/issues/21#issuecomment-427480892","issue_url":"https://api.github.com/repos/ankane/multiverse/issues/21","id":427480892,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzQ4MDg5Mg==","user":{"login":"ankane","id":220358,"node_id":"MDQ6VXNlcjIyMDM1OA==","avatar_url":"https://avatars3.githubusercontent.com/u/220358?v=4","gravatar_id":"","url":"https://api.github.com/users/ankane","html_url":"https://github.com/ankane","followers_url":"https://api.github.com/users/ankane/followers","following_url":"https://api.github.com/users/ankane/following{/other_user}","gists_url":"https://api.github.com/users/ankane/gists{/gist_id}","starred_url":"https://api.github.com/users/ankane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankane/subscriptions","organizations_url":"https://api.github.com/users/ankane/orgs","repos_url":"https://api.github.com/users/ankane/repos","events_url":"https://api.github.com/users/ankane/events{/privacy}","received_events_url":"https://api.github.com/users/ankane/received_events","type":"User","site_admin":false},"created_at":"2018-10-05T19:54:27Z","updated_at":"2018-10-05T19:54:27Z","author_association":"OWNER","body":"Hey @a-maas, you'll basically want to create an initializer and duplicate that logic for each of the additional databases. I think it'll be tricky to do generically since:\r\n\r\n1. Multiverse does not maintain an list of additional databases (could be inferred by searching `db/:database/schema_cache.yml`)\r\n2. The `use_schema_cache_dump` is deleted from config, so we won't have access to it (could also probably be inferred if `schema_cache.yml` exists)\r\n2. There's no explicit mapping from Multiverse databases to base model, and methods in the initializer like `connection` and `connection_pool` need to be called on the base model\r\n\r\nThe approach I'd take is to get a hard-coded version working in your app, then see if it's possible to make it generic."}}
{"actor":{"display_login":"ankane"}}