Derek Hulley 72a90a14f1 Merged V2.2 to HEAD
8078: Merged V2.1 to V2.2
      8025: Fixes WCM-1039, problems with case insensitive name handling.
   8079: Merged V2.1 to V2.2
      8035: -- DONE SEPARATELY --
      8040: Fix AR-1985: SQL Server dialect is derived from Sybase dialect there need additional no-op script
      8046: Better Javadocs for getChildByName()
      8056: Fixed WCM-790: Date conversion for metadata extractors
      8057: Fixed WCM-790: Properties that don't convert can be discarded (default is to fail)
      8059: -- DONE SEPARATELY --
      8061: Fixes WCM-790: Fallout from CHK-2168 and CHK-2169
   8081: Fix for WCM-1018
   8082: Merged V2.1 to V2.2
      8016: Merged V2.1-A to V2.1
         8000: Additional indexes for AVM
         8013: Patch to introduce reverse indexes required for AVM


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8474 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2008-03-10 12:17:10 +00:00

79 lines
2.9 KiB
SQL

--
-- Title: Create additional indexes and constraints
-- Database: MySQL
-- Since: V2.2 Schema 86
-- Author: Derek Hulley
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
CREATE INDEX idx_alf_adtd_woy ON alf_audit_date (week_of_year);
CREATE INDEX idx_alf_adtd_q ON alf_audit_date (quarter);
CREATE INDEX idx_alf_adtd_wom ON alf_audit_date (week_of_month);
CREATE INDEX idx_alf_adtd_dom ON alf_audit_date (day_of_month);
CREATE INDEX idx_alf_adtd_doy ON alf_audit_date (day_of_year);
CREATE INDEX idx_alf_adtd_dow ON alf_audit_date (day_of_week);
CREATE INDEX idx_alf_adtd_m ON alf_audit_date (month);
CREATE INDEX idx_alf_adtd_hy ON alf_audit_date (halfYear);
CREATE INDEX idx_alf_adtd_y ON alf_audit_date (year);
CREATE INDEX idx_alf_adtd_dat ON alf_audit_date (date_only);
CREATE INDEX idx_alf_adtf_ref ON alf_audit_fact (store_protocol, store_id, node_uuid);
CREATE INDEX idx_alf_adtf_usr ON alf_audit_fact (user_id);
CREATE INDEX idx_alf_adts_met ON alf_audit_source (method);
CREATE INDEX idx_alf_adts_ser ON alf_audit_source (service);
CREATE INDEX idx_alf_adts_app ON alf_audit_source (application);
CREATE INDEX idx_alf_ca_qn_ln ON alf_child_assoc (qname_localname);
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms);
CREATE INDEX idx_avm_np_name ON avm_node_properties (qname);
CREATE INDEX idx_avm_vr_version ON avm_version_roots (version_id);
--
-- Explicit indexes and constraints not declared in the mappings
--
CREATE INDEX fk_alf_na_qn ON alf_node_aspects (qname_id);
ALTER TABLE alf_node_aspects ADD CONSTRAINT fk_alf_na_qn FOREIGN KEY (qname_id) REFERENCES alf_qname (id);
CREATE INDEX fk_alf_np_qn ON alf_node_properties (qname_id);
ALTER TABLE alf_node_properties ADD CONSTRAINT fk_alf_np_qn FOREIGN KEY (qname_id) REFERENCES alf_qname (id);
CREATE INDEX fk_avm_na_qn ON avm_aspects_new (qname_id);
ALTER TABLE avm_aspects_new ADD CONSTRAINT fk_avm_na_qn FOREIGN KEY (qname_id) REFERENCES alf_qname (id);
CREATE INDEX fk_avm_np_qn ON avm_node_properties_new (qname_id);
ALTER TABLE avm_node_properties_new ADD CONSTRAINT fk_avm_np_qn FOREIGN KEY (qname_id) REFERENCES alf_qname (id);
CREATE INDEX idx_avm_hl_revpk ON avm_history_links (descendent, ancestor);
CREATE INDEX idx_avm_vr_revuq ON avm_version_roots (avm_store_id, version_id);
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints', 'Manually executed script upgrade V2.2: Created additional indexes and constraints',
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
);