-
Notifications
You must be signed in to change notification settings - Fork 4
Migration from cqrs_tools #10
Copy link
Copy link
Open
Description
I first of all thank you for cqrs_tools and blunt.
We are trying to migrate to blunt but have no idea on how to apply the migration.
Do you have a sample project we could use ?
(Edit) Steps to migrate
I will live update this comment with the steps followed to migrate from cqrs_tools to blunt. Please note that as we didn't use every available cqrs_tools feature, not everything will be documented
Install blunt
# mix.exs
defp deps do
[ {:blunt, github: "blunt-elixir/blunt", ref: "reorg", sparse: "apps/blunt", override: true},
{:blunt_data,
github: "blunt-elixir/blunt", ref: "reorg", sparse: "apps/blunt_data", override: true},
{:blunt_ddd,
github: "blunt-elixir/blunt", ref: "reorg", sparse: "apps/blunt_ddd", override: true},
{:blunt_absinthe,
github: "blunt-elixir/blunt", ref: "reorg", sparse: "apps/blunt_absinthe", override: true},
{:blunt_absinthe_relay,
github: "blunt-elixir/blunt",
ref: "reorg",
sparse: "apps/blunt_absinthe_relay",
override: true}]
endReplace imports
A find and replace from Cqrs to Blunt will handle ~80% of the migration
Message
Common struct patterns have been factored into Blunt.Message
It is used by (at least):
Blunt.CommandBlunt.ValueObject
Options
The option require_all_fields is now require_all_fields?
Behaviors
If using specific @impl (such as @impl Cqrs.ValueObject) for please note that it now implements Blunt.Message. This is important for migrating:
before_validatehandle_validateafter_validate
DomainEvent
fromoption is nowderive_from- If using
Cqrs.DomainEvent.new(__MODULE__, cmd, attrs)switch toBlunt.Message.Constructor.apply( __MODULE__, cmd, attrs, [])
Query
- The
filtermacro is not available anymore, use afielddirectly handle_createandhandle executeshould be implemented in a handler, see example
Absinthe
derive_input_objectis nowderive_object(name, module, input_object: true)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels