*/
-BEGIN;
SELECT CLOCK_TIMESTAMP(), 'Reingesting authority records';
+BEGIN;
+-- wrap the setup in a transaction so the script will die of something
+-- in here fails. Then run main reingest sans transaction.
+
-- add the flag ingest.disable_authority_full_rec if it does not exist
INSERT INTO config.internal_flag (name, enabled)
SELECT 'ingest.disable_authority_full_rec', FALSE
'ingest.disable_authority_full_rec'
);
+COMMIT;
+
+-- execute the main reingest outside of a transaction
+
ALTER TABLE authority.record_entry DISABLE TRIGGER a_marcxml_is_well_formed;
ALTER TABLE authority.record_entry DISABLE TRIGGER b_maintain_901;
ALTER TABLE authority.record_entry DISABLE TRIGGER c_maintain_control_numbers;
WHERE a.name = b.name;
SELECT CLOCK_TIMESTAMP(), 'Done reingesting authority records';
-COMMIT;