View Source How To Upgrade From 0.9.x to 1.0.x

Cloak 1.0.0 separated the Ecto components into a separate package: cloak_ecto. This required some breaking name changes.

  • Cloak's default JSON library is now Jason, not Poison
  • All Ecto-related modules now have the prefix Cloak.Ecto.
  • Cloak's Ecto types have a new naming scheme: Cloak.Fields.Binary became Cloak.Ecto.Binary.
  • mix cloak.migrate has been renamed to mix cloak.migrate.ecto.

install-cloak_ecto-1-0-0

Install cloak_ecto 1.0.0

Replace your cloak dependency with cloak_ecto.

{:cloak_ecto, "1.0.0"}

configure-json-library

Configure JSON Library

If you have not specified the :json_library setting in your Vault, and want to continue using Poison, you will need to add that setting:

config :my_app, MyApp.Vault,
  json_library: Poison,
  # ...

Otherwise, you will need to add Jason to your dependencies:

{:jason, "~> 1.0"}

update-cloak-field-references

Update Cloak Field References

Update all your Cloak field references from the old naming scheme to the new. For example:

use Cloak.Fields.Binary, vault: MyApp.Vault

Should now become:

use Cloak.Ecto.Binary, vault: MyApp.Vault

update-migration-references

Update Migration References

If you use Cloak.Migrator directly, rename your references to Cloak.Ecto.Migrator instead. If you use mix cloak.migrate, rename any references to mix cloak.migrate.ecto instead..