{"action":"created","issue":{"url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter/issues/2","repository_url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter","labels_url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter/issues/2/comments","events_url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter/issues/2/events","html_url":"https://github.com/EmpaticoOrg/scenic-mysql_adapter/issues/2","id":304840508,"number":2,"title":"schema.rb contains both `create_table` and `create_view` for newly created views","user":{"login":"josepegea","id":23210902,"avatar_url":"https://avatars3.githubusercontent.com/u/23210902?v=4","gravatar_id":"","url":"https://api.github.com/users/josepegea","html_url":"https://github.com/josepegea","followers_url":"https://api.github.com/users/josepegea/followers","following_url":"https://api.github.com/users/josepegea/following{/other_user}","gists_url":"https://api.github.com/users/josepegea/gists{/gist_id}","starred_url":"https://api.github.com/users/josepegea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josepegea/subscriptions","organizations_url":"https://api.github.com/users/josepegea/orgs","repos_url":"https://api.github.com/users/josepegea/repos","events_url":"https://api.github.com/users/josepegea/events{/privacy}","received_events_url":"https://api.github.com/users/josepegea/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-13T16:31:30Z","updated_at":"2018-03-13T16:39:33Z","closed_at":null,"author_association":"NONE","body":"# How to reproduce\r\n\r\nAdd a new view using a migration with `create_view` as suggested in the docs.\r\n\r\nReview `db/schema.rb` and you'll find that 2 new sections have been added to the file:\r\n\r\n```ruby\r\n create_table \"supply_sets\", id: false, force: :cascade do |t|\r\n   t.integer \"id\",            limit: 4,   default: 0,  null: false\r\n   (rest of columns here)\r\n end\r\n```\r\nand\r\n\r\n```ruby\r\n create_view \"supply_sets\",  sql_definition: <<-SQL\r\n     (SQL view definition here)\r\n SQL\r\n```\r\n\r\n# Why is this a problem?\r\n\r\nIf you try to prepare the test DB you get an error, as it first creates a table and then it tries to create a view with the same name.\r\n\r\n```\r\ngraymatter:pfm161-v4 jes$ spring rake db:test:prepare\r\nRunning via Spring preloader in process 10807\r\nrake aborted!\r\nActiveRecord::StatementInvalid: Mysql2::Error: Table 'supply_sets' already exists: CREATE VIEW `supply_sets` AS       (rest of view definition here)\r\n```\r\n\r\n# What can be done?\r\n\r\nThe problem seems to come from MySQL including views when you ask for a list of tables.\r\n\r\nSome tweak on `SchemaDumper#ignore?` could help to omit the views when generating the tables section of the `schema.rb` file.\r\n"},"comment":{"url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter/issues/comments/372732611","html_url":"https://github.com/EmpaticoOrg/scenic-mysql_adapter/issues/2#issuecomment-372732611","issue_url":"https://api.github.com/repos/EmpaticoOrg/scenic-mysql_adapter/issues/2","id":372732611,"user":{"login":"cainlevy","id":4449,"avatar_url":"https://avatars3.githubusercontent.com/u/4449?v=4","gravatar_id":"","url":"https://api.github.com/users/cainlevy","html_url":"https://github.com/cainlevy","followers_url":"https://api.github.com/users/cainlevy/followers","following_url":"https://api.github.com/users/cainlevy/following{/other_user}","gists_url":"https://api.github.com/users/cainlevy/gists{/gist_id}","starred_url":"https://api.github.com/users/cainlevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cainlevy/subscriptions","organizations_url":"https://api.github.com/users/cainlevy/orgs","repos_url":"https://api.github.com/users/cainlevy/repos","events_url":"https://api.github.com/users/cainlevy/events{/privacy}","received_events_url":"https://api.github.com/users/cainlevy/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T16:39:33Z","updated_at":"2018-03-13T16:39:33Z","author_association":"OWNER","body":"I wonder if this could be a Rails version issue? We've only used 5.x with this adapter so far."}}
{"actor":{"display_login":"cainlevy"}}