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, notPoison - All
Ecto-related modules now have the prefixCloak.Ecto. - Cloak’s
Ectotypes have a new naming scheme:Cloak.Fields.BinarybecameCloak.Ecto.Binary. mix cloak.migratehas been renamed tomix cloak.migrate.ecto.
Install cloak_ecto 1.0.0
Replace your cloak dependency with cloak_ecto.
{:cloak_ecto, "1.0.0-alpha.0"}
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 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
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..