Preserve hidden primary key when altering table

If we just add a secondary index, this code isn't run, because we don't have to copy the table.