PDB-510 Add migration to fix sequence for catalog.id

The sequence for catalog.id had not been incremented during insert for migration
20 'differential-catalog-resources'.

This meant that the catalog.id column would throw a constraint exception during
insertion until the sequence had increased enough to be greater then the max id
already used in the column.

While this was only a temporary error, it does cause puppetdb to start to throw
errors and potentially dropping some catalog updates until a certain number of
catalogs had been attempted. In some cases catalogs had been queued up and
retried successfully, other cases meant they were simply dropped into the DLQ.

The fix is to reset the sequence to match the max id on the catalogs.id column.

This patch includes a new migration with this step, that utilizes a new function
created to generically reset sequences based on table and catalog in a database
independant way.

Signed-off-by: Ken Barber <ken@bob.sh>
PDB-510 Add explicit locking and move fix-identity-sequence

This patch adds explicit locking of tables to fix-identity-sequence and moves
the function under storage-utils.clj.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #890 from kbarber/ticket/1.6.x/pdb-510-reset-catalog-sequence-to-latest-id

PDB-510 Add migration to fix sequence for catalog.id