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

Copy Markdown View Source

V72: Rename iduuid on Category A tables + add missing FK constraints.

Category A tables have a UUID primary key column named id. Ecto schemas map field :uuid → DB column id via source: :id. This migration renames the DB column to uuid so the source: :id mapping is no longer needed.

Changes

  • Rename iduuid on 30 Category A tables (metadata-only, instant)
  • Add 4 missing FK constraints:
    • phoenix_kit_comments.user_uuidphoenix_kit_users.uuid (CASCADE)
    • phoenix_kit_comments_dislikes.user_uuidphoenix_kit_users.uuid (CASCADE)
    • phoenix_kit_comments_likes.user_uuidphoenix_kit_users.uuid (CASCADE)
    • phoenix_kit_scheduled_jobs.created_by_uuidphoenix_kit_users.uuid (SET NULL)

All operations are idempotent (guarded by column/constraint existence checks).

Safety

  • Column renames are metadata-only in PostgreSQL — zero downtime, instant
  • 29 existing FK constraints referencing these columns auto-update on rename
  • Deploy is atomic: migration runs on startup before new code serves traffic

Summary

Functions

down(opts)

up(opts)