PhoenixKit.Migrations.Postgres.V75 (phoenix_kit v1.7.71)

Copy Markdown View Source

V75: Fix missing/wrong DEFAULT on uuid PK columns, drop orphaned sequence.

V72 renamed iduuid on 30 Category A tables, but the old id column's DEFAULT was a nextval() sequence — that got dropped during the rename. This left 27 tables with no DEFAULT on uuid. Additionally, 4 tables (comments module + role_permissions) had gen_random_uuid() (UUIDv4) instead of uuid_generate_v7() (UUIDv7).

While Ecto generates UUIDs in the app layer (autogenerate: true), a DB-level DEFAULT is important for:

  • Raw SQL inserts (e.g. migration scripts, manual fixes)
  • Defensive safety if Ecto doesn't provide a value

Changes

  1. Set DEFAULT uuid_generate_v7() on 27 tables missing it (Category A)
  2. Fix DEFAULT on 4 tables using gen_random_uuid() → uuid_generate_v7()
  3. Drop orphaned sequence phoenix_kit_id_seq (CASCADE — also drops the DEFAULT on phoenix_kit.id meta table column that references it)

Summary

Functions

down(opts)

up(opts)