reference creatortrack column order migration drift copy bug 20260715T230908

When copying table data between CreatorTrack environments (dev warm slot -> prod, or any dump/restore across clones), never use positional COPY. Column physical order in Postgres depends on the order migrations were applied, not the order they're defined in the migration files. If two environments applied the same set of migrations in different sequence, a table can end up with the same columns in different physical positions.

Concrete case (2026-07-15): app.social_videos had embedding and crosspost_of_id as its last two columns, but swapped between ct_warm_slot_1 and prod. A positional COPY ... FROM would have silently written 384-dim embedding vectors into the crosspost FK column and vice versa, corrupting both with no error.

Why: Postgres doesn't guarantee column position is deterministic across independently-migrated clones of the same schema; only the column set and types are guaranteed. How to apply: Any cross-environment table copy (COPY, pg_dump -t with custom restore logic, manual INSERT...SELECT) must always dump and load with an explicit, name-mapped column list, never COPY table FROM ... bare or INSERT INTO table SELECT *. Verify column order matches before trusting a positional copy anywhere in the CT stack.

[auto-memory session 60d132de-4659-485c-8044-427af0ccce7f, confidence 0.75, mode staged]