Skip to content

Referrals 0.8.0: Own migrations and support for PhoenixKit 3

Referrals 0.8.0 makes the module own its two database tables and works with PhoenixKit 3. Core 3.0 no longer creates module tables, so the module now builds them itself. On an existing site nothing changes but a version marker.

Its own migration chain

The module now has its own migrations, found by mix phoenix_kit.update. The first version takes over the referral codes and code usage tables exactly as core built them. On an existing install every table, constraint and index is already there, so the only new thing is a pkref_schema:1 marker on the codes table. On an install where core no longer creates the tables, the same steps create them. Rolling back changes the marker only and never drops a table or deletes rows.

Checks and repair

The module now describes its two tables for mix phoenix_kit.doctor and mix phoenix_kit.repair, so they check and repair them again, from the module’s own description instead of core’s. Repair only adds what is missing and reports the rest, and it checks the tables only while the database is at the chain’s current version. A core release after 2.64.1 is needed to read this description.

Upgrading

Referrals 0.8 needs PhoenixKit 2.65.0 or later and works up to 3.x. Update the dependency and run mix phoenix_kit.update to add the marker. No data changes.

Full release notes: Referrals 0.8.0

0.8.0 · 27 October 2026

Changed

  • Core pin widened to >= 2.65.0 and < 4.0.0: works with core 3.x (core 3.0 stops creating the module tables; this module’s own chain builds its tables). The floor is the first core with the file_references/0 and expected_schema/0 callbacks, which now carry @impl PhoenixKit.Module.

Added

  • The module supplies the manifest of its 2 tables (expected_schema/0, PhoenixKitReferrals.ExpectedSchema), so mix phoenix_kit.repair and mix phoenix_kit.doctor check and repair them again, now from the module’s own chain instead of core’s manifest. Generated from PhoenixKitReferrals.Migrations by core’s dev_docs/squash/generate_module_manifest.exs, never edited by hand. Core uses it from the first release after 2.64.1; before that nothing reads it. Repair is additive (it creates what is missing and reports the rest) and checks the tables only while the database is at the chain’s current version. No migration.
  • The module’s own migration chain, PhoenixKitReferrals.Migrations (migration_module/0). V1 adopts the two referral tables core’s chain creates, exactly as a fresh core install builds them, and stamps a pkref_schema:1 marker. Nothing changes on an existing install but the marker; from now on a change to these tables ships here instead of in core. A test proves the chain builds the tables without core (core’s PhoenixKit.TestSupport.ModuleChainCheck), with a small test database setup the suite did not have before.

Referrals 0.8.0. Install or update: {:phoenix_kit_referrals, "~> 0.8"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.