Audit and Prop table enhancements

- alf_prop_xxx tables
   - Added alf_prop_root table
   - alf_prop_value_xxx tables enforce uniqueness
   - Better splitting up of Collections and Maps (attempt to use exact storage type)
   - Moved some indexes around to reduce size but maintain index data lookups
   - Allow updates and deletes of properties via alf_prop_root (entry-point table)
 - Audit Application
   - Unique by name
   - Add 'disabled paths' to control audit behaviour (not wired into services)
   - Added concurrency checks for updates to the Audit Application (model change, etc)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16217 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-11 13:59:45 +00:00
parent de1e940d73
commit 29b94cf0d7
23 changed files with 1496 additions and 653 deletions

View File

@@ -20,10 +20,14 @@ CREATE TABLE alf_audit_model
CREATE TABLE alf_audit_app
(
id BIGINT NOT NULL AUTO_INCREMENT,
audit_model_id BIGINT NOT NULL,
version TINYINT NOT NULL,
app_name_id BIGINT NOT NULL,
CONSTRAINT fk_alf_audit_app_model FOREIGN KEY (audit_model_id) REFERENCES alf_audit_model (id) ON DELETE CASCADE,
audit_model_id BIGINT NOT NULL,
disabled_paths_id BIGINT NOT NULL,
CONSTRAINT fk_alf_audit_app_app FOREIGN KEY (app_name_id) REFERENCES alf_prop_value (id),
CONSTRAINT UNIQUE idx_alf_audit_app_app (app_name_id),
CONSTRAINT fk_alf_audit_app_model FOREIGN KEY (audit_model_id) REFERENCES alf_audit_model (id) ON DELETE CASCADE,
CONSTRAINT fk_alf_audit_app_dis FOREIGN KEY (disabled_paths_id) REFERENCES alf_prop_root (id),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -37,7 +41,7 @@ CREATE TABLE alf_audit_entry
CONSTRAINT fk_alf_audit_ent_app FOREIGN KEY (audit_app_id) REFERENCES alf_audit_app (id) ON DELETE CASCADE,
INDEX idx_alf_audit_ent_time (audit_time),
CONSTRAINT fk_alf_audit_ent_user FOREIGN KEY (audit_user_id) REFERENCES alf_prop_value (id),
CONSTRAINT fk_alf_audit_ent_prop FOREIGN KEY (audit_values_id) REFERENCES alf_prop_value (id),
CONSTRAINT fk_alf_audit_ent_prop FOREIGN KEY (audit_values_id) REFERENCES alf_prop_root (id),
PRIMARY KEY (id)
) ENGINE=InnoDB;

View File

@@ -38,10 +38,11 @@ CREATE TABLE alf_prop_double_value
(
id BIGINT NOT NULL AUTO_INCREMENT,
double_value DOUBLE NOT NULL,
INDEX idx_alf_prop_dbl_val (double_value),
UNIQUE INDEX idx_alf_prop_dbl_val (double_value),
PRIMARY KEY (id)
) ENGINE=InnoDB;
-- Stores unique, case-sensitive string values --
CREATE TABLE alf_prop_string_value
(
id BIGINT NOT NULL AUTO_INCREMENT,
@@ -49,7 +50,7 @@ CREATE TABLE alf_prop_string_value
string_end_lower VARCHAR(16) NOT NULL,
string_crc BIGINT NOT NULL,
INDEX idx_alf_prop_str (string_value(32)),
INDEX idx_alf_prop_crc (string_end_lower, string_crc),
UNIQUE INDEX idx_alf_prop_crc (string_end_lower, string_crc),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -67,19 +68,29 @@ CREATE TABLE alf_prop_value
persisted_type TINYINT NOT NULL,
long_value BIGINT NOT NULL,
INDEX idx_alf_prop_per (persisted_type, long_value),
INDEX idx_alf_prop_act (actual_type_id, long_value),
UNIQUE INDEX idx_alf_prop_act (actual_type_id, long_value),
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE alf_prop_root
(
id BIGINT NOT NULL AUTO_INCREMENT,
version TINYINT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE alf_prop_link
(
root_prop_id BIGINT NOT NULL,
current_prop_id BIGINT NOT NULL,
value_prop_id BIGINT NOT NULL,
prop_index BIGINT NOT NULL,
contained_in BIGINT NOT NULL,
key_prop_id BIGINT NOT NULL,
INDEX idx_alf_prop_coll_rev (value_prop_id, root_prop_id),
CONSTRAINT fk_alf_prop_link_root FOREIGN KEY (root_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
PRIMARY KEY (root_prop_id, current_prop_id, value_prop_id, key_prop_id)
value_prop_id BIGINT NOT NULL,
CONSTRAINT fk_alf_prop_link_root FOREIGN KEY (root_prop_id) REFERENCES alf_prop_root (id) ON DELETE CASCADE,
CONSTRAINT fk_alf_prop_link_key FOREIGN KEY (key_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
CONSTRAINT fk_alf_prop_link_val FOREIGN KEY (value_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
INDEX idx_alf_prop_link_for (root_prop_id, key_prop_id, value_prop_id),
PRIMARY KEY (root_prop_id, contained_in, prop_index)
) ENGINE=InnoDB;
--