Skip to content

Add V129: fix missing subscription_type_uuid column on subscriptions#583

Merged
ddon merged 1 commit into
BeamLabEU:mainfrom
mdon:main
Jun 5, 2026
Merged

Add V129: fix missing subscription_type_uuid column on subscriptions#583
ddon merged 1 commit into
BeamLabEU:mainfrom
mdon:main

Conversation

@mdon

@mdon mdon commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a fresh-install defect in phoenix_kit_subscriptions: the subscription_type_uuid UUID foreign key that PhoenixKitBilling.Schemas.Subscription uses was never added by any migration.

  • V33 created the table with an integer plan_id (later renamed to subscription_type_id in V65).
  • V65 conditionally renamed plan_uuid → subscription_type_uuid — but plan_uuid never existed, so the rename was a no-op on every fresh build.

Result: on a fresh ensure_current/2, the column is absent, and every subscription insert (and the billing Subscriptions LiveView) raises Postgrex.Error … undefined_column "subscription_type_uuid". Existing long-lived databases that somehow acquired the column are unaffected. (Surfaced by the phoenix_kit_billing quality sweep, which had to @tag :skip three subscription tests pending this fix.)

Change

New V129 migration, idempotent throughout (guarded DO-blocks):

  • adds subscription_type_uuid UUID to phoenix_kit_subscriptions
  • FK → phoenix_kit_subscription_types(uuid) ON DELETE SET NULL
  • partial index … WHERE subscription_type_uuid IS NOT NULL
  • bumps @current_version to 129; down/1 drops the index/FK/column and resets the marker to 128.

Verification

Fresh migrate (test.reset + ensure_current) on an empty DB:

  • subscription_type_uuid : uuid present ✓
  • FK phoenix_kit_subscriptions_subscription_type_uuid_fkey
  • index phoenix_kit_subscriptions_subscription_type_uuid_idx
  • COMMENT ON TABLE phoenix_kit = 129
  • mix format clean, mix credo --strict clean.

No @version / CHANGELOG bump (left for the release cut).

Follow-up

Once this ships in a release, the three @tag :skip subscription tests in phoenix_kit_billing can be un-skipped.

phoenix_kit_subscriptions never actually gained the subscription_type_uuid
UUID FK the billing Subscription schema uses: V33 created plan_id (integer),
V65 only conditionally *renamed* plan_uuid -> subscription_type_uuid, and
plan_uuid never existed. So on a fresh ensure_current/2 build the column was
absent and subscription inserts / the Subscriptions LiveView raised
undefined_column. Add it idempotently (UUID, FK to
phoenix_kit_subscription_types(uuid) ON DELETE SET NULL, partial index),
bump @current_version to 129. Verified on a fresh migrate: column + FK +
index present, marker = 129.
@ddon ddon merged commit 0585e94 into BeamLabEU:main Jun 5, 2026
ddon pushed a commit that referenced this pull request Jun 5, 2026
retryable?/1 now retries {:ai_error, {:api_error, 429}} as defense-in-depth:
the built-in OpenRouter client maps 429 -> :rate_limited (snoozed), but a
custom/future provider may surface a bare {:api_error, 429}, which is the
canonical retry-after and should retry rather than discard on first attempt.
Also corrects the :timeout clause comment (Completion remaps transport
timeouts to :request_timeout before they reach the worker) and updates the
test (429 now asserts retryable; added a 404 refute).

Updates the PR #582 review doc: 429 item RESOLVED+FIXED with the verified
PhoenixKitAI contract, a dated follow-up section splitting fixed vs
developer-owned items, and a PR #583 (V129) verdict (no issues).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants