{"action":"created","issue":{"url":"https://api.github.com/repos/mybb/mybb/issues/2451","repository_url":"https://api.github.com/repos/mybb/mybb","labels_url":"https://api.github.com/repos/mybb/mybb/issues/2451/labels{/name}","comments_url":"https://api.github.com/repos/mybb/mybb/issues/2451/comments","events_url":"https://api.github.com/repos/mybb/mybb/issues/2451/events","html_url":"https://github.com/mybb/mybb/issues/2451","id":166487738,"number":2451,"title":"Unique keys in tables","user":{"login":"kloddant","id":4429325,"avatar_url":"https://avatars.githubusercontent.com/u/4429325?v=3","gravatar_id":"","url":"https://api.github.com/users/kloddant","html_url":"https://github.com/kloddant","followers_url":"https://api.github.com/users/kloddant/followers","following_url":"https://api.github.com/users/kloddant/following{/other_user}","gists_url":"https://api.github.com/users/kloddant/gists{/gist_id}","starred_url":"https://api.github.com/users/kloddant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kloddant/subscriptions","organizations_url":"https://api.github.com/users/kloddant/orgs","repos_url":"https://api.github.com/users/kloddant/repos","events_url":"https://api.github.com/users/kloddant/events{/privacy}","received_events_url":"https://api.github.com/users/kloddant/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mybb/mybb/labels/1.8","name":"1.8","color":"5319e7"},{"url":"https://api.github.com/repos/mybb/mybb/labels/s:feedback","name":"s:feedback","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-20T03:38:34Z","updated_at":"2016-07-20T11:40:36Z","closed_at":null,"body":"It would be convenient for people writing custom database migration code or plugins to have unique keys in all the appropriate places in the database tables.  This could also be useful in case the code that inserts and updates these tables ends up accidentally overlooking an implicit unique key.  I haven't looked at anything besides mysql yet, but for mysql, I would propose adding the following keys in the locations indicated in mybb/install/resources/mysql_db_tables.php:\r\n\r\nUNIQUE KEY (uid) in mybb_awaiting activation\r\nUNIQUE KEY (badword) in mybb_badwords\r\nUNIQUE KEY (filter) in mybb_banfilters\r\nUNIQUE KEY uid_gid (uid, gid) in mybb_banned\r\nUNIQUE KEY uid_toid (uid, toid) in mybb_buddyrequests\r\nUNIQUE KEY (name) in mybb_calendars\r\nUNIQUE KEY cid_gid (cid, gid) in mybb_calendarpermissions\r\nUNIQUE KEY (title) in mybb_datacache\r\nUNIQUE KEY (name) in mybb_events\r\nUNIQUE KEY fid_gid (fid, gid) in mybb_forumpermissions\r\nUNIQUE KEY name_pid (name, pid) in mybb_forums\r\nUNIQUE KEY fid_uid (fid, uid) in mybb_forumsubscriptions\r\nUNIQUE KEY gid_uid (gid, uid) in mybb_groupleaders\r\nUNIQUE KEY sid_name (sid, name) in mybb_helpdocs\r\nUNIQUE KEY (name) in mybb_helpsections\r\nUNIQUE KEY (name) in mybb_icons\r\nUNIQUE KEY (name) in mybb_modtools\r\nUNIQUE KEY (title) in mybb_mycode\r\nUNIQUE KEY (name) in mybb_profilefields\r\nUNIQUE KEY (name) in mybb_settinggroups\r\nUNIQUE KEY (title) in mybb_settinggroups\r\nUNIQUE KEY (name) in mybb_smilies\r\nUNIQUE KEY (name) in mybb_spiders\r\nUNIQUE KEY (title) in mybb_tasks\r\nUNIQUE KEY (prefix) in mybb_templategroups\r\nUNIQUE KEY (title) in mybb_templategroups\r\nUNIQUE KEY (title) in mybb_templates\r\nUNIQUE KEY (title) in mybb_templatesets\r\nUNIQUE KEY (name) in mybb_themes\r\nUNIQUE KEY (prefix) in mybb_threadprefixes\r\nUNIQUE KEY tid_uid (tid, uid) in mybb_threadratings\r\nUNIQUE KEY uid_tid (uid, tid) in mybb_threadsubscriptions\r\nUNIQUE KEY (title) in mybb_usergroups\r\nUNIQUE KEY (email) in mybb_users\r\nUNIQUE KEY (title) in mybb_usertitles\r\nUNIQUE KEY (title) in mybb_warningtypes"},"comment":{"url":"https://api.github.com/repos/mybb/mybb/issues/comments/233925567","html_url":"https://github.com/mybb/mybb/issues/2451#issuecomment-233925567","issue_url":"https://api.github.com/repos/mybb/mybb/issues/2451","id":233925567,"user":{"login":"kloddant","id":4429325,"avatar_url":"https://avatars.githubusercontent.com/u/4429325?v=3","gravatar_id":"","url":"https://api.github.com/users/kloddant","html_url":"https://github.com/kloddant","followers_url":"https://api.github.com/users/kloddant/followers","following_url":"https://api.github.com/users/kloddant/following{/other_user}","gists_url":"https://api.github.com/users/kloddant/gists{/gist_id}","starred_url":"https://api.github.com/users/kloddant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kloddant/subscriptions","organizations_url":"https://api.github.com/users/kloddant/orgs","repos_url":"https://api.github.com/users/kloddant/repos","events_url":"https://api.github.com/users/kloddant/events{/privacy}","received_events_url":"https://api.github.com/users/kloddant/received_events","type":"User","site_admin":false},"created_at":"2016-07-20T11:40:36Z","updated_at":"2016-07-20T11:40:36Z","body":"Okay, well the list should be narrowed down a bit then, but there are still some keys here which should definitely be unique.  I was wondering about the email address thing, but since MyBB allows login and password reset via email address, I figured it had to be unique."}}
{"actor":{"display_login":"kloddant"}}