{"action":"opened","issue":{"url":"https://api.github.com/repos/angell-co/Portal/issues/5","repository_url":"https://api.github.com/repos/angell-co/Portal","labels_url":"https://api.github.com/repos/angell-co/Portal/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/angell-co/Portal/issues/5/comments","events_url":"https://api.github.com/repos/angell-co/Portal/issues/5/events","html_url":"https://github.com/angell-co/Portal/issues/5","id":380763772,"node_id":"MDU6SXNzdWUzODA3NjM3NzI=","number":5,"title":"ERROR 1071 (42000) at line 1307: Specified key was too long; max key length is 767 bytes","user":{"login":"mtwalsh","id":1246553,"node_id":"MDQ6VXNlcjEyNDY1NTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1246553?v=4","gravatar_id":"","url":"https://api.github.com/users/mtwalsh","html_url":"https://github.com/mtwalsh","followers_url":"https://api.github.com/users/mtwalsh/followers","following_url":"https://api.github.com/users/mtwalsh/following{/other_user}","gists_url":"https://api.github.com/users/mtwalsh/gists{/gist_id}","starred_url":"https://api.github.com/users/mtwalsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtwalsh/subscriptions","organizations_url":"https://api.github.com/users/mtwalsh/orgs","repos_url":"https://api.github.com/users/mtwalsh/repos","events_url":"https://api.github.com/users/mtwalsh/events{/privacy}","received_events_url":"https://api.github.com/users/mtwalsh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-14T15:55:09Z","updated_at":"2018-11-14T15:55:09Z","closed_at":null,"author_association":"NONE","body":"Hi Josh,\r\n\r\nI think the SQL code below is causing an issue with MySQL 5.6 as it is trying to put an UNIQUE index on a `VARCHAR(500)` field, this isn't a problem in MySQL 5.7 but does cause the `Specified key was too long; max key length is 767 bytes` error in MySQL 5.6:\r\n\r\n```\r\nDROP TABLE IF EXISTS `portal_targets_sites`;\r\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\r\n/*!40101 SET character_set_client = utf8 */;\r\nCREATE TABLE `portal_targets_sites` (\r\n  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n  `targetId` int(11) NOT NULL,\r\n  `siteId` int(11) DEFAULT NULL,\r\n  `template` varchar(500) DEFAULT NULL,\r\n  `dateCreated` datetime NOT NULL,\r\n  `dateUpdated` datetime NOT NULL,\r\n  `uid` char(36) NOT NULL DEFAULT '0',\r\n  PRIMARY KEY (`id`),\r\n  UNIQUE KEY `portal_targets_sites_targetId_siteId_unq_idx` (`targetId`,`siteId`),\r\n  UNIQUE KEY `portal_targets_sites_targetId_siteId_template_unq_idx` (`targetId`,`siteId`,`template`),\r\n  KEY `portal_targets_sites_siteId_idx` (`siteId`),\r\n  CONSTRAINT `portal_targets_sites_siteId_fk` FOREIGN KEY (`siteId`) REFERENCES `sites` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\r\n  CONSTRAINT `portal_targets_sites_targetId_fk` FOREIGN KEY (`targetId`) REFERENCES `portal_targets` (`id`) ON DELETE CASCADE\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n/*!40101 SET character_set_client = @saved_cs_client */;\r\n```\r\nChanging this:\r\n```\r\n`template` varchar(500) DEFAULT NULL,\r\n```\r\nTo this (255), would likely fix it but with unknown consequences!:\r\n```\r\n`template` varchar(255) DEFAULT NULL,\r\n```\r\nOr remove the `template` field from the UNIQUE if that's possible."}}
{"actor":{"display_login":"mtwalsh"}}