{"action":"created","comment":{"url":"https://api.github.com/repos/go-gitea/gitea/pulls/comments/198304073","pull_request_review_id":132212713,"id":198304073,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODMwNDA3Mw==","diff_hunk":"@@ -29,75 +57,99 @@ func reformatAndRemoveIncorrectTopics(x *xorm.Engine) (err error) {\n \tdelTopicIDs := make([]int64, 0, batchSize)\n \tids := make([]int64, 0, 30)\n \n+\tlog.Info(\"Validating existed topics...\")\n \tif err := sess.Begin(); err != nil {\n \t\treturn err\n \t}\n-\tlog.Info(\"Validating existed topics...\")\n \tfor start := 0; ; start += batchSize {\n \t\ttopics = topics[:0]\n-\t\tif err := sess.Asc(\"id\").Limit(batchSize, start).Find(&topics); err != nil {\n+\t\tif err := x.Cols(\"id\", \"name\").Asc(\"id\").Limit(batchSize, start).Find(&topics); err != nil {\n \t\t\treturn err\n \t\t}\n \t\tif len(topics) == 0 {\n \t\t\tbreak\n \t\t}\n \t\tfor _, topic := range topics {\n-\t\t\tif models.ValidateTopic(topic.Name) {\n+\t\t\tif validateTopic(topic.Name) {\n \t\t\t\tcontinue\n \t\t\t}\n+\t\t\tlog.Info(\"Incorrect topic: id = %v, name = %q\", topic.ID, topic.Name)\n+\n \t\t\ttopic.Name = strings.Replace(strings.TrimSpace(strings.ToLower(topic.Name)), \" \", \"-\", -1)\n \n+\t\t\tids = ids[:0]","path":"models/migrations/v68.go","position":78,"original_position":78,"commit_id":"646acabb1fa1df862e1aeb6b9994297dd8bb3a16","original_commit_id":"646acabb1fa1df862e1aeb6b9994297dd8bb3a16","user":{"login":"techknowlogick","id":164197,"node_id":"MDQ6VXNlcjE2NDE5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/164197?v=4","gravatar_id":"","url":"https://api.github.com/users/techknowlogick","html_url":"https://github.com/techknowlogick","followers_url":"https://api.github.com/users/techknowlogick/followers","following_url":"https://api.github.com/users/techknowlogick/following{/other_user}","gists_url":"https://api.github.com/users/techknowlogick/gists{/gist_id}","starred_url":"https://api.github.com/users/techknowlogick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techknowlogick/subscriptions","organizations_url":"https://api.github.com/users/techknowlogick/orgs","repos_url":"https://api.github.com/users/techknowlogick/repos","events_url":"https://api.github.com/users/techknowlogick/events{/privacy}","received_events_url":"https://api.github.com/users/techknowlogick/received_events","type":"User","site_admin":false},"body":"It looks like you are resetting the `ids` variable here back to an empty array. Can you change this variable to a different scope, such as define `ids` inside this loop so you don't need to have this line?","created_at":"2018-06-26T21:29:55Z","updated_at":"2018-06-26T21:33:07Z","html_url":"https://github.com/go-gitea/gitea/pull/4297#discussion_r198304073","pull_request_url":"https://api.github.com/repos/go-gitea/gitea/pulls/4297","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/go-gitea/gitea/pulls/comments/198304073"},"html":{"href":"https://github.com/go-gitea/gitea/pull/4297#discussion_r198304073"},"pull_request":{"href":"https://api.github.com/repos/go-gitea/gitea/pulls/4297"}}},"pull_request":{"url":"https://api.github.com/repos/go-gitea/gitea/pulls/4297","id":196604365,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NjA0MzY1","html_url":"https://github.com/go-gitea/gitea/pull/4297","diff_url":"https://github.com/go-gitea/gitea/pull/4297.diff","patch_url":"https://github.com/go-gitea/gitea/pull/4297.patch","issue_url":"https://api.github.com/repos/go-gitea/gitea/issues/4297","number":4297,"state":"open","locked":false,"title":"Fixed violation of the unique constraint for v68 migration","user":{"login":"axifive","id":844963,"node_id":"MDQ6VXNlcjg0NDk2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/844963?v=4","gravatar_id":"","url":"https://api.github.com/users/axifive","html_url":"https://github.com/axifive","followers_url":"https://api.github.com/users/axifive/followers","following_url":"https://api.github.com/users/axifive/following{/other_user}","gists_url":"https://api.github.com/users/axifive/gists{/gist_id}","starred_url":"https://api.github.com/users/axifive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axifive/subscriptions","organizations_url":"https://api.github.com/users/axifive/orgs","repos_url":"https://api.github.com/users/axifive/repos","events_url":"https://api.github.com/users/axifive/events{/privacy}","received_events_url":"https://api.github.com/users/axifive/received_events","type":"User","site_admin":false},"body":"as title","created_at":"2018-06-21T23:42:48Z","updated_at":"2018-06-26T21:33:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"385be3df832c0402a61319162a0c65ab70b906a3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":472744938,"node_id":"MDU6TGFiZWw0NzI3NDQ5Mzg=","url":"https://api.github.com/repos/go-gitea/gitea/labels/kind/bug","name":"kind/bug","color":"ee0701","default":false},{"id":475283844,"node_id":"MDU6TGFiZWw0NzUyODM4NDQ=","url":"https://api.github.com/repos/go-gitea/gitea/labels/lgtm/need%201","name":"lgtm/need 1","color":"f9d0c4","default":false}],"milestone":{"url":"https://api.github.com/repos/go-gitea/gitea/milestones/21","html_url":"https://github.com/go-gitea/gitea/milestone/21","labels_url":"https://api.github.com/repos/go-gitea/gitea/milestones/21/labels","id":3004249,"node_id":"MDk6TWlsZXN0b25lMzAwNDI0OQ==","number":21,"title":"1.5.0","description":"","creator":{"login":"lunny","id":81045,"node_id":"MDQ6VXNlcjgxMDQ1","avatar_url":"https://avatars2.githubusercontent.com/u/81045?v=4","gravatar_id":"","url":"https://api.github.com/users/lunny","html_url":"https://github.com/lunny","followers_url":"https://api.github.com/users/lunny/followers","following_url":"https://api.github.com/users/lunny/following{/other_user}","gists_url":"https://api.github.com/users/lunny/gists{/gist_id}","starred_url":"https://api.github.com/users/lunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunny/subscriptions","organizations_url":"https://api.github.com/users/lunny/orgs","repos_url":"https://api.github.com/users/lunny/repos","events_url":"https://api.github.com/users/lunny/events{/privacy}","received_events_url":"https://api.github.com/users/lunny/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":343,"state":"open","created_at":"2017-12-30T04:21:56Z","updated_at":"2018-06-26T14:45:19Z","due_on":"2018-06-15T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/go-gitea/gitea/pulls/4297/commits","review_comments_url":"https://api.github.com/repos/go-gitea/gitea/pulls/4297/comments","review_comment_url":"https://api.github.com/repos/go-gitea/gitea/pulls/comments{/number}","comments_url":"https://api.github.com/repos/go-gitea/gitea/issues/4297/comments","statuses_url":"https://api.github.com/repos/go-gitea/gitea/statuses/646acabb1fa1df862e1aeb6b9994297dd8bb3a16","head":{"label":"axifive:fix-v68-migration","ref":"fix-v68-migration","sha":"646acabb1fa1df862e1aeb6b9994297dd8bb3a16","user":{"login":"axifive","id":844963,"node_id":"MDQ6VXNlcjg0NDk2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/844963?v=4","gravatar_id":"","url":"https://api.github.com/users/axifive","html_url":"https://github.com/axifive","followers_url":"https://api.github.com/users/axifive/followers","following_url":"https://api.github.com/users/axifive/following{/other_user}","gists_url":"https://api.github.com/users/axifive/gists{/gist_id}","starred_url":"https://api.github.com/users/axifive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axifive/subscriptions","organizations_url":"https://api.github.com/users/axifive/orgs","repos_url":"https://api.github.com/users/axifive/repos","events_url":"https://api.github.com/users/axifive/events{/privacy}","received_events_url":"https://api.github.com/users/axifive/received_events","type":"User","site_admin":false},"repo":{"id":133351385,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMzNTEzODU=","name":"gitea","full_name":"axifive/gitea","owner":{"login":"axifive","id":844963,"node_id":"MDQ6VXNlcjg0NDk2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/844963?v=4","gravatar_id":"","url":"https://api.github.com/users/axifive","html_url":"https://github.com/axifive","followers_url":"https://api.github.com/users/axifive/followers","following_url":"https://api.github.com/users/axifive/following{/other_user}","gists_url":"https://api.github.com/users/axifive/gists{/gist_id}","starred_url":"https://api.github.com/users/axifive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axifive/subscriptions","organizations_url":"https://api.github.com/users/axifive/orgs","repos_url":"https://api.github.com/users/axifive/repos","events_url":"https://api.github.com/users/axifive/events{/privacy}","received_events_url":"https://api.github.com/users/axifive/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/axifive/gitea","description":"Gitea: Git with a cup of tea","fork":true,"url":"https://api.github.com/repos/axifive/gitea","forks_url":"https://api.github.com/repos/axifive/gitea/forks","keys_url":"https://api.github.com/repos/axifive/gitea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/axifive/gitea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/axifive/gitea/teams","hooks_url":"https://api.github.com/repos/axifive/gitea/hooks","issue_events_url":"https://api.github.com/repos/axifive/gitea/issues/events{/number}","events_url":"https://api.github.com/repos/axifive/gitea/events","assignees_url":"https://api.github.com/repos/axifive/gitea/assignees{/user}","branches_url":"https://api.github.com/repos/axifive/gitea/branches{/branch}","tags_url":"https://api.github.com/repos/axifive/gitea/tags","blobs_url":"https://api.github.com/repos/axifive/gitea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/axifive/gitea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/axifive/gitea/git/refs{/sha}","trees_url":"https://api.github.com/repos/axifive/gitea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/axifive/gitea/statuses/{sha}","languages_url":"https://api.github.com/repos/axifive/gitea/languages","stargazers_url":"https://api.github.com/repos/axifive/gitea/stargazers","contributors_url":"https://api.github.com/repos/axifive/gitea/contributors","subscribers_url":"https://api.github.com/repos/axifive/gitea/subscribers","subscription_url":"https://api.github.com/repos/axifive/gitea/subscription","commits_url":"https://api.github.com/repos/axifive/gitea/commits{/sha}","git_commits_url":"https://api.github.com/repos/axifive/gitea/git/commits{/sha}","comments_url":"https://api.github.com/repos/axifive/gitea/comments{/number}","issue_comment_url":"https://api.github.com/repos/axifive/gitea/issues/comments{/number}","contents_url":"https://api.github.com/repos/axifive/gitea/contents/{+path}","compare_url":"https://api.github.com/repos/axifive/gitea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/axifive/gitea/merges","archive_url":"https://api.github.com/repos/axifive/gitea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/axifive/gitea/downloads","issues_url":"https://api.github.com/repos/axifive/gitea/issues{/number}","pulls_url":"https://api.github.com/repos/axifive/gitea/pulls{/number}","milestones_url":"https://api.github.com/repos/axifive/gitea/milestones{/number}","notifications_url":"https://api.github.com/repos/axifive/gitea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/axifive/gitea/labels{/name}","releases_url":"https://api.github.com/repos/axifive/gitea/releases{/id}","deployments_url":"https://api.github.com/repos/axifive/gitea/deployments","created_at":"2018-05-14T11:35:54Z","updated_at":"2018-06-11T14:29:56Z","pushed_at":"2018-06-26T14:42:20Z","git_url":"git://github.com/axifive/gitea.git","ssh_url":"git@github.com:axifive/gitea.git","clone_url":"https://github.com/axifive/gitea.git","svn_url":"https://github.com/axifive/gitea","homepage":"http://gitea.io","size":116678,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"go-gitea:master","ref":"master","sha":"b8c2420ae283f6163826c3b8614db1e44b5c0ef0","user":{"login":"go-gitea","id":12724356,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzI0MzU2","avatar_url":"https://avatars1.githubusercontent.com/u/12724356?v=4","gravatar_id":"","url":"https://api.github.com/users/go-gitea","html_url":"https://github.com/go-gitea","followers_url":"https://api.github.com/users/go-gitea/followers","following_url":"https://api.github.com/users/go-gitea/following{/other_user}","gists_url":"https://api.github.com/users/go-gitea/gists{/gist_id}","starred_url":"https://api.github.com/users/go-gitea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/go-gitea/subscriptions","organizations_url":"https://api.github.com/users/go-gitea/orgs","repos_url":"https://api.github.com/users/go-gitea/repos","events_url":"https://api.github.com/users/go-gitea/events{/privacy}","received_events_url":"https://api.github.com/users/go-gitea/received_events","type":"Organization","site_admin":false},"repo":{"id":72495579,"node_id":"MDEwOlJlcG9zaXRvcnk3MjQ5NTU3OQ==","name":"gitea","full_name":"go-gitea/gitea","owner":{"login":"go-gitea","id":12724356,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzI0MzU2","avatar_url":"https://avatars1.githubusercontent.com/u/12724356?v=4","gravatar_id":"","url":"https://api.github.com/users/go-gitea","html_url":"https://github.com/go-gitea","followers_url":"https://api.github.com/users/go-gitea/followers","following_url":"https://api.github.com/users/go-gitea/following{/other_user}","gists_url":"https://api.github.com/users/go-gitea/gists{/gist_id}","starred_url":"https://api.github.com/users/go-gitea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/go-gitea/subscriptions","organizations_url":"https://api.github.com/users/go-gitea/orgs","repos_url":"https://api.github.com/users/go-gitea/repos","events_url":"https://api.github.com/users/go-gitea/events{/privacy}","received_events_url":"https://api.github.com/users/go-gitea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/go-gitea/gitea","description":"Git with a cup of tea, painless self-hosted git service","fork":false,"url":"https://api.github.com/repos/go-gitea/gitea","forks_url":"https://api.github.com/repos/go-gitea/gitea/forks","keys_url":"https://api.github.com/repos/go-gitea/gitea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/go-gitea/gitea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/go-gitea/gitea/teams","hooks_url":"https://api.github.com/repos/go-gitea/gitea/hooks","issue_events_url":"https://api.github.com/repos/go-gitea/gitea/issues/events{/number}","events_url":"https://api.github.com/repos/go-gitea/gitea/events","assignees_url":"https://api.github.com/repos/go-gitea/gitea/assignees{/user}","branches_url":"https://api.github.com/repos/go-gitea/gitea/branches{/branch}","tags_url":"https://api.github.com/repos/go-gitea/gitea/tags","blobs_url":"https://api.github.com/repos/go-gitea/gitea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/go-gitea/gitea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/go-gitea/gitea/git/refs{/sha}","trees_url":"https://api.github.com/repos/go-gitea/gitea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/go-gitea/gitea/statuses/{sha}","languages_url":"https://api.github.com/repos/go-gitea/gitea/languages","stargazers_url":"https://api.github.com/repos/go-gitea/gitea/stargazers","contributors_url":"https://api.github.com/repos/go-gitea/gitea/contributors","subscribers_url":"https://api.github.com/repos/go-gitea/gitea/subscribers","subscription_url":"https://api.github.com/repos/go-gitea/gitea/subscription","commits_url":"https://api.github.com/repos/go-gitea/gitea/commits{/sha}","git_commits_url":"https://api.github.com/repos/go-gitea/gitea/git/commits{/sha}","comments_url":"https://api.github.com/repos/go-gitea/gitea/comments{/number}","issue_comment_url":"https://api.github.com/repos/go-gitea/gitea/issues/comments{/number}","contents_url":"https://api.github.com/repos/go-gitea/gitea/contents/{+path}","compare_url":"https://api.github.com/repos/go-gitea/gitea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/go-gitea/gitea/merges","archive_url":"https://api.github.com/repos/go-gitea/gitea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/go-gitea/gitea/downloads","issues_url":"https://api.github.com/repos/go-gitea/gitea/issues{/number}","pulls_url":"https://api.github.com/repos/go-gitea/gitea/pulls{/number}","milestones_url":"https://api.github.com/repos/go-gitea/gitea/milestones{/number}","notifications_url":"https://api.github.com/repos/go-gitea/gitea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/go-gitea/gitea/labels{/name}","releases_url":"https://api.github.com/repos/go-gitea/gitea/releases{/id}","deployments_url":"https://api.github.com/repos/go-gitea/gitea/deployments","created_at":"2016-11-01T02:13:26Z","updated_at":"2018-06-26T21:19:51Z","pushed_at":"2018-06-26T21:31:13Z","git_url":"git://github.com/go-gitea/gitea.git","ssh_url":"git@github.com:go-gitea/gitea.git","clone_url":"https://github.com/go-gitea/gitea.git","svn_url":"https://github.com/go-gitea/gitea","homepage":"https://gitea.io","size":115319,"stargazers_count":8763,"watchers_count":8763,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":832,"mirror_url":null,"archived":false,"open_issues_count":887,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":832,"open_issues":887,"watchers":8763,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/go-gitea/gitea/pulls/4297"},"html":{"href":"https://github.com/go-gitea/gitea/pull/4297"},"issue":{"href":"https://api.github.com/repos/go-gitea/gitea/issues/4297"},"comments":{"href":"https://api.github.com/repos/go-gitea/gitea/issues/4297/comments"},"review_comments":{"href":"https://api.github.com/repos/go-gitea/gitea/pulls/4297/comments"},"review_comment":{"href":"https://api.github.com/repos/go-gitea/gitea/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/go-gitea/gitea/pulls/4297/commits"},"statuses":{"href":"https://api.github.com/repos/go-gitea/gitea/statuses/646acabb1fa1df862e1aeb6b9994297dd8bb3a16"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"techknowlogick"}}