{"action":"created","issue":{"url":"https://api.github.com/repos/interagent/pliny/issues/224","labels_url":"https://api.github.com/repos/interagent/pliny/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/interagent/pliny/issues/224/comments","events_url":"https://api.github.com/repos/interagent/pliny/issues/224/events","html_url":"https://github.com/interagent/pliny/issues/224","id":113077366,"number":224,"title":"Cannot `rake db:schema:load` the result of `rake db:schema:dump`","user":{"login":"mars","id":17164,"avatar_url":"https://avatars.githubusercontent.com/u/17164?v=3","gravatar_id":"","url":"https://api.github.com/users/mars","html_url":"https://github.com/mars","followers_url":"https://api.github.com/users/mars/followers","following_url":"https://api.github.com/users/mars/following{/other_user}","gists_url":"https://api.github.com/users/mars/gists{/gist_id}","starred_url":"https://api.github.com/users/mars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars/subscriptions","organizations_url":"https://api.github.com/users/mars/orgs","repos_url":"https://api.github.com/users/mars/repos","events_url":"https://api.github.com/users/mars/events{/privacy}","received_events_url":"https://api.github.com/users/mars/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-23T18:42:50Z","updated_at":"2015-10-23T18:46:02Z","closed_at":null,"body":"I'm trying to synchronize my local dev environment with a pre-existing app.\r\n\r\nGiven the **schema.sql** from `rake db:schema:dump` on the existing Pliny app, I do the following:\r\n1. `rake db:create`\r\n2. `rake db:schema:load`\r\n\r\n  ```\r\nrake aborted!\r\nSequel::DatabaseError: PG::UndefinedTable: ERROR:  relation \"schema_migrations\" does not exist\r\nLINE 912: INSERT INTO \"schema_migrations\" (\"filename\") VALUES ('144485...\r\n                      ^\r\n  ```\r\n\r\nLooking through the source for these rake tasks, it looks like [the `dump` task outputs these](https://github.com/interagent/pliny/blob/master/lib/pliny/tasks/db.rake#L103) ` INSERT INTO \"schema_migrations\" …` commands, but [the `load` task does not](https://github.com/interagent/pliny/blob/master/lib/pliny/tasks/db.rake#L75) create the `\"schema_migrations\"` table, so it fails with this error.\r\n\r\nThis **schema.sql** contains structure for the Heroku Connect `salesforce` schema too, so I cannot fall back on the app's migrations for this.\r\n\r\nWhat is the right way to use `rake db:schema:dump` and `rake db:schema:load`? Would a PR to make the `load` task create the `\"schema_migrations\"` table be acceptable?"},"comment":{"url":"https://api.github.com/repos/interagent/pliny/issues/comments/150660601","html_url":"https://github.com/interagent/pliny/issues/224#issuecomment-150660601","issue_url":"https://api.github.com/repos/interagent/pliny/issues/224","id":150660601,"user":{"login":"mars","id":17164,"avatar_url":"https://avatars.githubusercontent.com/u/17164?v=3","gravatar_id":"","url":"https://api.github.com/users/mars","html_url":"https://github.com/mars","followers_url":"https://api.github.com/users/mars/followers","following_url":"https://api.github.com/users/mars/following{/other_user}","gists_url":"https://api.github.com/users/mars/gists{/gist_id}","starred_url":"https://api.github.com/users/mars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars/subscriptions","organizations_url":"https://api.github.com/users/mars/orgs","repos_url":"https://api.github.com/users/mars/repos","events_url":"https://api.github.com/users/mars/events{/privacy}","received_events_url":"https://api.github.com/users/mars/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T18:46:02Z","updated_at":"2015-10-23T18:46:02Z","body":"More interesting, it looks like the **schema.sql** does actually define this missing table:\r\n```\r\n--\r\n-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: \r\n--\r\n\r\nCREATE TABLE schema_migrations (\r\n    filename text NOT NULL\r\n);\r\n```\r\n\r\n…yet it is not visible to the `INSERT` statements."}}