1 -- Resolve some discrepancies in the auditor schema between a fresh
2 -- install and an upgraded database.
6 INSERT INTO config.upgrade_log (version) VALUES ('0413'); -- Scott McKellar
8 UPDATE auditor.actor_org_unit_history
9 SET fiscal_calendar = 1
10 WHERE fiscal_calendar IS NULL;
12 ALTER TABLE auditor.actor_org_unit_history
13 ALTER COLUMN fiscal_calendar SET NOT NULL;
15 DROP VIEW auditor.actor_org_unit_lifecycle;
17 SELECT auditor.create_auditor_lifecycle( 'actor', 'org_unit' );
19 ALTER TABLE auditor.actor_usr_history
20 ALTER COLUMN claims_never_checked_out_count DROP DEFAULT;
22 DROP VIEW auditor.actor_usr_lifecycle;
24 SELECT auditor.create_auditor_lifecycle( 'actor', 'usr' );
26 UPDATE auditor.asset_call_number_history
28 WHERE label_class IS NULL;
30 ALTER TABLE auditor.asset_call_number_history
31 ALTER COLUMN label_class SET NOT NULL;
33 DROP VIEW auditor.asset_call_number_lifecycle;
35 SELECT auditor.create_auditor_lifecycle( 'asset', 'call_number' );
37 UPDATE auditor.asset_copy_history
39 WHERE floating IS NULL;
41 ALTER TABLE auditor.asset_copy_history
42 ALTER COLUMN floating SET NOT NULL;
44 DROP VIEW auditor.asset_copy_lifecycle;
46 SELECT auditor.create_auditor_lifecycle( 'asset', 'copy' );
48 DROP VIEW auditor.biblio_record_entry_lifecycle;
50 SELECT auditor.create_auditor_lifecycle( 'biblio', 'record_entry' );
54 -- Outside of transaction; failure is okay if the
55 -- index already exists
57 \qecho Creating some indexes outside of a transaction. If a CREATE
58 \qecho fails because the index already exists, ignore the failure.
60 CREATE INDEX aud_actor_usr_address_hist_id_idx
61 ON auditor.actor_usr_address_history ( id );
63 CREATE INDEX aud_actor_usr_hist_id_idx
64 ON auditor.actor_usr_history ( id );
66 CREATE INDEX aud_asset_cn_hist_creator_idx
67 ON auditor.asset_call_number_history ( creator );
69 CREATE INDEX aud_asset_cn_hist_editor_idx
70 ON auditor.asset_call_number_history ( editor );
72 CREATE INDEX aud_asset_cp_hist_creator_idx
73 ON auditor.asset_copy_history ( creator );
75 CREATE INDEX aud_asset_cp_hist_editor_idx
76 ON auditor.asset_copy_history ( editor );
78 CREATE INDEX aud_bib_rec_entry_hist_creator_idx
79 ON auditor.biblio_record_entry_history ( creator );
81 CREATE INDEX aud_bib_rec_entry_hist_editor_idx
82 ON auditor.biblio_record_entry_history ( editor );