From 65965a99345d135bd7766fc067e38dab05689a78 Mon Sep 17 00:00:00 2001 From: Alexander Don Date: Sat, 14 Feb 2026 22:16:50 +0200 Subject: [PATCH] Fix V56 migration: add subscription_plans to uuid column setup lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The subscription_plans table was referenced as an FK source in UUIDFKColumns but wasn't included in the uuid column setup lists, causing a Postgrex 42703 (undefined_column) error on V55→V56 upgrades. Add phoenix_kit_subscription_plans to @tables_missing_column, @all_tables, @tables_ensure_not_null, and @tables_ensure_index so the uuid column exists before the FK backfill executes. All operations are idempotent — safe no-ops on sequential V34→V56 paths where V40 already created the column. --- lib/phoenix_kit/migrations/postgres/v56.ex | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/phoenix_kit/migrations/postgres/v56.ex b/lib/phoenix_kit/migrations/postgres/v56.ex index cb5b2bbe..d98e63d9 100644 --- a/lib/phoenix_kit/migrations/postgres/v56.ex +++ b/lib/phoenix_kit/migrations/postgres/v56.ex @@ -39,9 +39,10 @@ defmodule PhoenixKit.Migrations.Postgres.V56 do schema (`consent_log.ex`) declares `field :uuid, Ecto.UUID, read_after_writes: true`. Additionally, `phoenix_kit_payment_methods`, `phoenix_kit_ai_endpoints`, - `phoenix_kit_ai_prompts`, and `phoenix_kit_sync_connections` were created without - uuid columns but are referenced as FK source tables in UUIDFKColumns (the backfill - SQL does `SET uuid_fk = s.uuid FROM source_table s`). + `phoenix_kit_ai_prompts`, `phoenix_kit_sync_connections`, and + `phoenix_kit_subscription_plans` were created without uuid columns but are + referenced as FK source tables in UUIDFKColumns (the backfill SQL does + `SET uuid_fk = s.uuid FROM source_table s`). ### 5. Wrong DEFAULT on UUID primary keys (gen_random_uuid → uuid_generate_v7) V55 Comments module tables use UUID as primary key with `gen_random_uuid()`. @@ -98,7 +99,8 @@ defmodule PhoenixKit.Migrations.Postgres.V56 do :phoenix_kit_payment_methods, :phoenix_kit_ai_endpoints, :phoenix_kit_ai_prompts, - :phoenix_kit_sync_connections + :phoenix_kit_sync_connections, + :phoenix_kit_subscription_plans ] # Tables using UUID as primary key with wrong DEFAULT (V55 Comments module) @@ -117,6 +119,7 @@ defmodule PhoenixKit.Migrations.Postgres.V56 do :phoenix_kit_ai_endpoints, :phoenix_kit_ai_prompts, :phoenix_kit_sync_connections, + :phoenix_kit_subscription_plans, # V45 — Shop Module :phoenix_kit_shop_categories, :phoenix_kit_shop_products, @@ -148,6 +151,7 @@ defmodule PhoenixKit.Migrations.Postgres.V56 do :phoenix_kit_ai_endpoints, :phoenix_kit_ai_prompts, :phoenix_kit_sync_connections, + :phoenix_kit_subscription_plans, # V46 tables (created nullable) :phoenix_kit_shop_config, :phoenix_kit_shop_import_logs, @@ -172,6 +176,7 @@ defmodule PhoenixKit.Migrations.Postgres.V56 do :phoenix_kit_ai_endpoints, :phoenix_kit_ai_prompts, :phoenix_kit_sync_connections, + :phoenix_kit_subscription_plans, # V45 tables (no unique index created) :phoenix_kit_shop_categories, :phoenix_kit_shop_products,