{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/424","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/424/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/424/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/424/events","html_url":"https://github.com/elixir-lang/ecto/pull/424","id":56164670,"number":424,"title":"Add support for adding/dropping indexes concurrently with Postgres","user":{"login":"whatyouhide","id":3890250,"avatar_url":"https://avatars.githubusercontent.com/u/3890250?v=3","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-01T14:12:44Z","updated_at":"2015-02-02T10:26:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elixir-lang/ecto/pulls/424","html_url":"https://github.com/elixir-lang/ecto/pull/424","diff_url":"https://github.com/elixir-lang/ecto/pull/424.diff","patch_url":"https://github.com/elixir-lang/ecto/pull/424.patch"},"body":"I added support for adding/dropping indexes concurrently as specified in #391.\r\n\r\nI'm not sure this PR is ready to merge, I think I need a short review first.\r\n\r\nThe most straightforward part has been adding `@disable_ddl_transaction` to `Ecto.Migration`: what I did was adding a `@before_compile` hook in `Ecto.Migration.__using__/1` in order to define a `__disable_ddl_transaction__/0` function on the migration module. This way, I can retrieve that value in `Ecto.Migrator` and avoid wrapping everything inside a transaction if that's the case.\r\n\r\nThe part I'm the least sure about is actually adding the `CONCURRENTLY` keyword to the query. I added the `:concurrently` field to the `Ecto.Migration.Index` struct and added the `CONCURRENTLY` only for the Postgres adapter (since only Postgres supports this option AFAIK), but didn't take any measure to ensure that the `:concurrently` field is ignored (or raised against) by other adapters.\r\n\r\nWhat do you think for now?\r\n\r\n**PS** I'd also love a small review to the unit test I wrote; I have to check that no transactions are run, but the schema migrator runs one so I can't just do `refute_receive {:transaction, _}`. Let me know!"},"comment":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/comments/72434706","html_url":"https://github.com/elixir-lang/ecto/pull/424#issuecomment-72434706","issue_url":"https://api.github.com/repos/elixir-lang/ecto/issues/424","id":72434706,"user":{"login":"whatyouhide","id":3890250,"avatar_url":"https://avatars.githubusercontent.com/u/3890250?v=3","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T10:26:38Z","updated_at":"2015-02-02T10:26:38Z","body":"Ok, working on it!"}}