reference creatortrack migration order column drift 20260715T231520
name: CT: divergent migration order can physically swap table columns across environments description: When the same CreatorTrack migrations apply in different order across dev-slot vs prod DBs, added columns can land in swapped physical positions, positional COPY silently corrupts data. type: reference
During the 2026-07-15 Scripts-app prod data load, social_videos's embedding and crosspost_of_id columns were physically swapped in column order between a dev warm-slot DB and prod, because the two migrations that added those columns were applied in a different order on each side.
Why: Dev warm slots and prod can diverge in migration application order (parallel branches, different deploy timing), and Postgres column position is determined by add-order, not name. A COPY or INSERT ... SELECT without an explicit column list maps by position, so this would have written embedding vectors into the crosspost_of_id column and vice versa, silently.
How to apply: Any time you copy/dump table data between a CreatorTrack dev slot and prod (or between any two DBs with independently-applied migrations), always dump and load with explicit, name-mapped column lists, never rely on positional COPY/SELECT *. Worth a quick column-order diff (\d tablename on both sides) before any cross-environment data copy on tables that have had columns added post-fork.
[auto-memory session 60d132de-4659-485c-8044-427af0ccce7f, confidence 0.75, mode staged]