{"action":"created","issue":{"url":"https://api.github.com/repos/sungwoncho/has_friendship/issues/17","repository_url":"https://api.github.com/repos/sungwoncho/has_friendship","labels_url":"https://api.github.com/repos/sungwoncho/has_friendship/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/sungwoncho/has_friendship/issues/17/comments","events_url":"https://api.github.com/repos/sungwoncho/has_friendship/issues/17/events","html_url":"https://github.com/sungwoncho/has_friendship/pull/17","id":133839583,"number":17,"title":"fix migration generator to ensure distinct version numbers","user":{"login":"atarihomestar","id":88783,"avatar_url":"https://avatars.githubusercontent.com/u/88783?v=3","gravatar_id":"","url":"https://api.github.com/users/atarihomestar","html_url":"https://github.com/atarihomestar","followers_url":"https://api.github.com/users/atarihomestar/followers","following_url":"https://api.github.com/users/atarihomestar/following{/other_user}","gists_url":"https://api.github.com/users/atarihomestar/gists{/gist_id}","starred_url":"https://api.github.com/users/atarihomestar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atarihomestar/subscriptions","organizations_url":"https://api.github.com/users/atarihomestar/orgs","repos_url":"https://api.github.com/users/atarihomestar/repos","events_url":"https://api.github.com/users/atarihomestar/events{/privacy}","received_events_url":"https://api.github.com/users/atarihomestar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-15T23:09:38Z","updated_at":"2016-02-20T01:11:22Z","closed_at":"2016-02-20T01:04:43Z","pull_request":{"url":"https://api.github.com/repos/sungwoncho/has_friendship/pulls/17","html_url":"https://github.com/sungwoncho/has_friendship/pull/17","diff_url":"https://github.com/sungwoncho/has_friendship/pull/17.diff","patch_url":"https://github.com/sungwoncho/has_friendship/pull/17.patch"},"body":"The addition of the add_blocker_id_to_friendships functionality meant that the migration generator now generates 2 migrations. The method to generate each template is fast enough that the 2 calls might happen within the same second, causing their version numbers to be the same. I thought of adding a sleep(1) in between the calls, but that seems kind of lame.  Instead the code I changed ensures that each call to migration_template generates a name that has a unique version number.  It works even if more migrations are added later."},"comment":{"url":"https://api.github.com/repos/sungwoncho/has_friendship/issues/comments/186473022","html_url":"https://github.com/sungwoncho/has_friendship/pull/17#issuecomment-186473022","issue_url":"https://api.github.com/repos/sungwoncho/has_friendship/issues/17","id":186473022,"user":{"login":"sungwoncho","id":8265228,"avatar_url":"https://avatars.githubusercontent.com/u/8265228?v=3","gravatar_id":"","url":"https://api.github.com/users/sungwoncho","html_url":"https://github.com/sungwoncho","followers_url":"https://api.github.com/users/sungwoncho/followers","following_url":"https://api.github.com/users/sungwoncho/following{/other_user}","gists_url":"https://api.github.com/users/sungwoncho/gists{/gist_id}","starred_url":"https://api.github.com/users/sungwoncho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sungwoncho/subscriptions","organizations_url":"https://api.github.com/users/sungwoncho/orgs","repos_url":"https://api.github.com/users/sungwoncho/repos","events_url":"https://api.github.com/users/sungwoncho/events{/privacy}","received_events_url":"https://api.github.com/users/sungwoncho/received_events","type":"User","site_admin":false},"created_at":"2016-02-20T01:11:22Z","updated_at":"2016-02-20T01:11:22Z","body":"Thanks for pointing out and solving this issue. @Pensarfeo, thanks for your input. Adding `sleep(1)` is more readable, but as @atarihomestar said, making a code deliberately slow seems not the best way.\r\n\r\nI will publish this fix because the issue might be preventing people from using the gem. But we can certainly discuss further to find a better solution."}}