Good reminder that copying explicit IDs bypasses nextval(), so the sequence never advances. Two small additions: pg_get_serial_sequence('public.products','id') avoids hardcoding the sequence name in the setval call, and Django ships manage.py sqlsequencereset <app> to generate exactly these statements after a manual data load. It could also be worth adding a post-migration check that compares MAX(id) with the sequence's last_value for every serial column, so this fails in staging instead of showing up as intermittent save errors. Did you consider IDENTITY columns for the new schema? They behave the same way when you insert explicit values, so the same resync step applies.