Adds a deletion workflow to a resource
Generates a deletion resource that waits a grace period after a deletion
is requested, then runs a :purge action and moves to :deleted. A
request can be restored during the grace period. The subject gains
has_one :deletion and a pending_deletion? calculation. When the
subject does not exist, it is created with mix ash.gen.resource first.
Every purge fails until the application defines what it erases, in the
generated Changes.Purge module. Nobody may request a deletion, request
it again, retry a purge or restore a deletion until the application
defines who can, in the generated Checks.CanRequest and
Checks.CanRestore modules.
Example
mix ash_workflow.gen.deletion MyApp.Accounts.Account --grace-period 30d
Options
--grace-period- required. How long a request waits before the purge runs, given as30m,12h,2dor2w. A duration under a minute needsAshWorkflow.Scheduler.Precise.--max-attempts- how many times the purge runs before the deletion moves to:purge_failed. Defaults to3. With1, noretryblock is generated.--module- the deletion resource's module name. Defaults to the subject's name withDeletionappended.--domain- the domain for a subject the task creates. Required only when the subject does not exist.--transition-log- also generates a transition log for the deletion withmix ash_workflow.gen.transition_log. Defaults totrue.