]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0413.schema.upgrade-auditor-tables.sql
LP#1733695: Stamping upgrade scripts for multilingual search
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0413.schema.upgrade-auditor-tables.sql
1 -- Resolve some discrepancies in the auditor schema between a fresh
2 -- install and an upgraded database.
3
4 BEGIN;
5
6 INSERT INTO config.upgrade_log (version) VALUES ('0413'); -- Scott McKellar
7
8 DROP VIEW auditor.actor_org_unit_lifecycle;
9
10 SELECT auditor.create_auditor_lifecycle( 'actor', 'org_unit' );
11
12 ALTER TABLE auditor.actor_usr_history
13         ALTER COLUMN claims_never_checked_out_count DROP DEFAULT;
14
15 DROP VIEW auditor.actor_usr_lifecycle;
16
17 SELECT auditor.create_auditor_lifecycle( 'actor', 'usr' );
18
19 DROP VIEW auditor.asset_call_number_lifecycle;
20
21 SELECT auditor.create_auditor_lifecycle( 'asset', 'call_number' );
22
23 DROP VIEW auditor.asset_copy_lifecycle;
24
25 SELECT auditor.create_auditor_lifecycle( 'asset', 'copy' );
26
27 DROP VIEW auditor.biblio_record_entry_lifecycle;
28
29 SELECT auditor.create_auditor_lifecycle( 'biblio', 'record_entry' );
30
31 COMMIT;
32
33 -- Outside of transaction; failure is okay if the 
34 -- index already exists
35
36 \qecho Creating some indexes outside of a transaction.  If a CREATE
37 \qecho fails because the index already exists, ignore the failure.
38
39 CREATE INDEX aud_actor_usr_address_hist_id_idx
40         ON auditor.actor_usr_address_history ( id );
41
42 CREATE INDEX aud_actor_usr_hist_id_idx
43     ON auditor.actor_usr_history ( id );
44
45 CREATE INDEX aud_asset_cn_hist_creator_idx
46         ON auditor.asset_call_number_history ( creator );
47
48 CREATE INDEX aud_asset_cn_hist_editor_idx
49         ON auditor.asset_call_number_history ( editor );
50
51 CREATE INDEX aud_asset_cp_hist_creator_idx
52         ON auditor.asset_copy_history ( creator );
53
54 CREATE INDEX aud_asset_cp_hist_editor_idx
55         ON auditor.asset_copy_history ( editor );
56
57 CREATE INDEX aud_bib_rec_entry_hist_creator_idx
58         ON auditor.biblio_record_entry_history ( creator );
59
60 CREATE INDEX aud_bib_rec_entry_hist_editor_idx
61         ON auditor.biblio_record_entry_history ( editor );