Skip to content

Newsletters 0.3.0: Cancel really stops a send, and the module gets its own migrations

Newsletters 0.3.0 makes Cancel broadcast stop the emails that are already waiting in the queue, and gives the module a migration chain of its own for future changes to its tables.

Cancel stops queued emails

A throttled broadcast queues its emails minutes or hours apart, so a cancel nearly always lands while many are still waiting. Cancelling only marked the broadcast as cancelled; the queued emails still went out. Each delivery now checks the broadcast before it sends, and once more just before handing the email to the provider. If the broadcast is no longer sending, the email is skipped. Its delivery stays pending rather than being counted as a failure, so a cancel does not show up as bounces.

The module’s own migrations

The module now owns the future shape of its broadcasts and deliveries tables. The next mix phoenix_kit.update generates one migration for it. Its first step only adopts what core already built: every statement is guarded, it changes no column, constraint or index on an existing site, and it adds a version marker to the broadcasts table. Rolling it back never drops a table or a row.

The guards recognise existing keys and indexes by their shape, not their name, so a site that renamed the old phoenix_kit_mailing_* tables adopts cleanly instead of failing or getting duplicate indexes.

Other changes

The README now describes the current model: CRM list and role audiences, the email preferences page, the send pipeline and the migration chain.

Upgrading

Run mix phoenix_kit.update and migrate. No requirement changes.

Full release notes: Newsletters 0.3.0

0.3.0 · 17 September 2026

Added

  • Module-owned migration chain. PhoenixKitNewsletters.Migrations, wired in through migration_module/0, now owns the future shape of phoenix_kit_newsletters_broadcasts and phoenix_kit_newsletters_deliveries. The next mix phoenix_kit.update on a host generates one migration for it. V1 is a pure adoption of the shape core’s V135–V158 already built: every statement is guarded, it changes no column, constraint or index on an existing install, and it only stamps a pknl_schema:1 comment on the broadcasts table. down/1 never drops either table or any rows. (#35)
  • The guards match existing primary keys, foreign keys, indexes and CHECKs by shape rather than by name. A host that renamed the tables from phoenix_kit_mailing_* (renaming a table keeps its old constraint and index names) therefore adopts cleanly instead of failing with “multiple primary keys” or getting duplicate indexes. Expression indexes can’t be mistaken for plain ones. (#35)
  • Broadcast.column_widths/0 and Delivery.column_widths/0: the varchar widths the migration DDL reads, so they are defined in one place. (#35)

Changed

  • README rewritten to match the current model: CRM-list / role audiences, preference center, send pipeline and migration chain. The removed List/ListMember model is gone from the docs. (#35)
  • index_guard now escapes its partial-index predicate in the catalog comparison as well as in the EXECUTE argument. The SQL it generates today is unchanged.
  • Dependency updates: phoenix_kit 2.28.1, phoenix 1.8.14, phoenix_live_view 1.2.12, swoosh 1.28.1, phoenix_kit_crm 0.14.0 (test).

Newsletters 0.3.0. Install or update: {:phoenix_kit_newsletters, "~> 0.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.