rails console u = User.find(9) u.id = 7 # There is no other record with id 7 u.save => true User.all
The id has not changed.
How to change the primary
For me worked:
User.find(9).update_column(:id, 7)