mix couchx.mango_index (Couchx v0.4.14)

Creates the index documents defined in the priv/repo/index/ path.

The migration files should be exs files and can have a up and down functions.

Examples

defmodule MyApp.Repo.Index.MyIndex do
  use Couchx.MangoIndex, repo_name: BS.Repo

  def up do
    create_index("my-index") do
      %{fields: ["name", "email"]}
    end
  end

  def down do
    drop_index("my-index")
  end
end

Current convention is that the file name uses - to separate words, and this is used to create de module name.

Example

$ priv/my_repo/index/my-index.exs
$ mix couchx.mango_index

Couchx will need knowledge of the main OTP app supervising the repos, also we need to configure ecto repos.

Example

  confix :couchx, otp_app: :my_app
  config :my_app, ecto_repos: [MyApp.Repo, Custom.Repo]

The task will look for paths for all the repos and process the indexes it finds.