ALTER TABLE audit
    ALTER record_id ADD GENERATED ALWAYS AS IDENTITY;
ALTER TABLE comment
    ALTER id ADD GENERATED ALWAYS AS IDENTITY;
ALTER TABLE migration
    ALTER id ADD GENERATED ALWAYS AS IDENTITY;
ALTER TABLE notification
    ALTER id ADD GENERATED ALWAYS AS IDENTITY;

SELECT setval(pg_get_serial_sequence('audit', 'record_id'), (select coalesce(max(record_id) + 1, 1) from audit));
SELECT setval(pg_get_serial_sequence('comment', 'id'), (select coalesce(max(id) + 1, 1) from comment));
SELECT setval(pg_get_serial_sequence('migration', 'id'), (select coalesce(max(id) + 1, 1) from migration));
SELECT setval(pg_get_serial_sequence('notification', 'id'), (select coalesce(max(id) + 1, 1) from notification));
