{"action":"created","issue":{"url":"https://api.github.com/repos/Shopify/lhm/issues/12","labels_url":"https://api.github.com/repos/Shopify/lhm/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/Shopify/lhm/issues/12/comments","events_url":"https://api.github.com/repos/Shopify/lhm/issues/12/events","html_url":"https://github.com/Shopify/lhm/pull/12","id":120240717,"number":12,"title":"Create emoji friendly tables by default","user":{"login":"jordanwheeler","id":2702398,"avatar_url":"https://avatars.githubusercontent.com/u/2702398?v=3","gravatar_id":"","url":"https://api.github.com/users/jordanwheeler","html_url":"https://github.com/jordanwheeler","followers_url":"https://api.github.com/users/jordanwheeler/followers","following_url":"https://api.github.com/users/jordanwheeler/following{/other_user}","gists_url":"https://api.github.com/users/jordanwheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/jordanwheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordanwheeler/subscriptions","organizations_url":"https://api.github.com/users/jordanwheeler/orgs","repos_url":"https://api.github.com/users/jordanwheeler/repos","events_url":"https://api.github.com/users/jordanwheeler/events{/privacy}","received_events_url":"https://api.github.com/users/jordanwheeler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-03T18:43:13Z","updated_at":"2015-12-03T20:13:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Shopify/lhm/pulls/12","html_url":"https://github.com/Shopify/lhm/pull/12","diff_url":"https://github.com/Shopify/lhm/pull/12.diff","patch_url":"https://github.com/Shopify/lhm/pull/12.patch"},"body":"This will patch LHM to create all tables with `DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC` by default.  As long as a table has an LHM run on it at some point, it'll now be emoji friendly without us having to manually update it.\r\n\r\nThe code is pretty simple.  Normally when creating the new table, LHM takes the existing table's attributes and simply swaps its name with `lhmn_#{name}`.  This adds a regex that'll also swap the `DEFAULT CHARSET=x` with `DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC`  \r\n\r\nGetting the integration tests passing was a bit of a nightmare, but I've finally got everything passing locally. \r\n\r\nProof (from the integration tests):\r\n\r\n```\r\nCREATE TABLE `lhmn_users` (\r\n  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n  `reference` int(11) DEFAULT NULL,\r\n  `username` varchar(255) DEFAULT NULL,\r\n  `group` varchar(255) DEFAULT 'Superfriends',\r\n  `created_at` datetime DEFAULT NULL,\r\n  `comment` varchar(20) DEFAULT NULL,\r\n  `description` text,\r\n  PRIMARY KEY (`id`),\r\n  UNIQUE KEY `index_users_on_reference` (`reference`),\r\n  KEY `index_users_on_username_and_created_at` (`username`,`created_at`),\r\n  KEY `index_with_a_custom_name` (`username`,`group`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC /* large hadron migration */\r\n```\r\n@SingerWang @jasonhl "},"comment":{"url":"https://api.github.com/repos/Shopify/lhm/issues/comments/161769894","html_url":"https://github.com/Shopify/lhm/pull/12#issuecomment-161769894","issue_url":"https://api.github.com/repos/Shopify/lhm/issues/12","id":161769894,"user":{"login":"jordanwheeler","id":2702398,"avatar_url":"https://avatars.githubusercontent.com/u/2702398?v=3","gravatar_id":"","url":"https://api.github.com/users/jordanwheeler","html_url":"https://github.com/jordanwheeler","followers_url":"https://api.github.com/users/jordanwheeler/followers","following_url":"https://api.github.com/users/jordanwheeler/following{/other_user}","gists_url":"https://api.github.com/users/jordanwheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/jordanwheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordanwheeler/subscriptions","organizations_url":"https://api.github.com/users/jordanwheeler/orgs","repos_url":"https://api.github.com/users/jordanwheeler/repos","events_url":"https://api.github.com/users/jordanwheeler/events{/privacy}","received_events_url":"https://api.github.com/users/jordanwheeler/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T20:13:34Z","updated_at":"2015-12-03T20:13:34Z","body":"I just added a commit so this will handle `DEFAULT CHARSET`, `CHARSET`, or no charset defined at all, since that's actually entirely optional."}}