{"action":"closed","issue":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/553","labels_url":"https://api.github.com/repos/jinzhu/gorm/issues/553/labels{/name}","comments_url":"https://api.github.com/repos/jinzhu/gorm/issues/553/comments","events_url":"https://api.github.com/repos/jinzhu/gorm/issues/553/events","html_url":"https://github.com/jinzhu/gorm/issues/553","id":92499442,"number":553,"title":"quoting breaks alter table on mariadb","user":{"login":"yanfali","id":2275667,"avatar_url":"https://avatars.githubusercontent.com/u/2275667?v=3","gravatar_id":"","url":"https://api.github.com/users/yanfali","html_url":"https://github.com/yanfali","followers_url":"https://api.github.com/users/yanfali/followers","following_url":"https://api.github.com/users/yanfali/following{/other_user}","gists_url":"https://api.github.com/users/yanfali/gists{/gist_id}","starred_url":"https://api.github.com/users/yanfali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanfali/subscriptions","organizations_url":"https://api.github.com/users/yanfali/orgs","repos_url":"https://api.github.com/users/yanfali/repos","events_url":"https://api.github.com/users/yanfali/events{/privacy}","received_events_url":"https://api.github.com/users/yanfali/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-01T22:34:31Z","updated_at":"2015-08-01T03:55:47Z","closed_at":"2015-08-01T03:55:47Z","body":"git commit 27a442b5ecef401a3ba2325383a96a09b0a983d9 breaks mariadb alter table statements:\r\n\r\nBroken generated SQL:\r\n```\r\nALTER TABLE `drawer` ADD CONSTRAINT `drawer_analyst_id_foreign` FOREIGN KEY (`analyst_id`) REFERENCES `analyst(id)` ON DELETE RESTRICT ON UPDATE RESTRICT;\r\n```\r\nWorking SQL:\r\n```\r\nALTER TABLE `drawer` ADD CONSTRAINT drawer_analyst_id_foreign FOREIGN KEY (analyst_id) REFERENCES analyst(id) ON DELETE RESTRICT ON UPDATE RESTRICT;\r\n```\r\nSeems like mariadb specifically doesn't like quoting of REFERENCES `analyst(id)` and throws an sql error:\r\n```\r\n2015/07/01 15:29:29 Error 1005: Can't create table `analyst`.`#sql-562_210` (errno: 150 \"Foreign key constraint is incorrectly formed\")\r\n```"}}