Skip to content

Instantly share code, notes, and snippets.

@alanpeabody
Created February 7, 2015 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanpeabody/c3365ac9528a44f73e9e to your computer and use it in GitHub Desktop.
Save alanpeabody/c3365ac9528a44f73e9e to your computer and use it in GitHub Desktop.
drop_if_exists
defp execute_in_direction(repo, :forward, level, {:create_if_not_exists, %Index{}=index}) do
if !repo.adapter.ddl_exists?(repo, index, @opts) do
repo.adapter.execute_ddl(repo, {:create, index}, @opts)
end
end
defp execute_in_direction(repo, :backward, level, {:drop_if_exists, %Index{}=index}) do
if !repo.adapter.ddl_exists?(repo, index, @opts) do
repo.adapter.execute_ddl(repo, {:create, index}, @opts)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment