alphagov/pp-puppet — pull request #570 by tombooth (2014-08-27 12:37:17+00:00)
Title: Add a function to check sequence sync

We've had an issue where sequences have got out of sync with the fields
they are being used by. This manifested as values being generated for
values that already existed in the field in tables, as these are ids
this caused a uniqueness check to fail.

This function will return all of the sequences, the last values they
generated and the maximum value of the field in the table they are used
it. User should then be able to eyeball the out of sync sequences.

This will currently break if any sequence is not in the format
[table]_id_seq for the id field in the given table. Sorry to the person
that finds this commit message and has to fix this. Maybe PostgreSQL
supports regex extraction to pull field and table name.