Update failed due to primary key sequence error

Oh… kay. That’s not entirely what I was expecting. In a perfect world, I’d love to know how you’ve managed to end up with a sequence so far out of whack, but I’m guessing we’re not going to live in a perfect world today.

The easy solution is run the following in psql:

alter sequence schema_migration_details_id_seq restart 750;

That’ll get the sequence back on track, and will stop the error from occuring. However, without knowing how this happened (I’ve never seen it happen before, and I’ve been doing this a long time), I can’t guarantee there might not be other craziness lurking in your database. You may well be in for a rough time.