mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
9018: MT: system-wide jobs should run across all stores/indexes 9204: Merged V2.2 to V2.9 8633: Merged V2.1 to V2.2 8629: Merged V2.1-A to V2.1 8493: Fixed ADB-51: ImporterBootstrap doesn't use transaction retrying 8494: EHCache and JGroup patches and upgrades 8546: ACT-1650: performance optimization 8550: Fixes to transactional cache handling 8553: Fixed tests: MLText is a Map, but will always have at least one entry, even that entry is null. 8583: ACT-954: IndexInfo files now reopen when they close (for whatever reason) 8640: Merged V2.1 to V2.2 8638: Used correct exception type for IO channel reopen logic 9102: Unit test to check that transactional cache size overrun is handled 9106: Merged V2.1 to V2.2 9043: Fixed AR-2291: SchemaBootstrap lock is only required before first SQL execution 9045: Fix AR-2291: SchemaBootstrap lock is only required before first SQL execution 9047: Fixed AR-2305: Index tracking in AUTO mode doesn't report anything on bootstrap 9048: Fixed AR-2300: Random-based GUID instead of time-based GUIDs 9049: Fix patches to only run once 9050 <Defered>: Changed getString() method to use the available buffer length rather than a hard coded value. 9060: Fixed ETWOONE-109 and ETWOONE-128: RetryingTransactionHelper fixes and improvements 9061: Fixed NodeRefPropertyMethodInterceptorTest 9075 <Defered>: Added delete permission check when marking a file for delete on close. ETWOONE-141/ACT-2416. 9080: Fixed EHCache source zip 9081: Fixed ETWOONE-118: Tomcat failed bootstrap doesn't clean up EHCache cluster structures 9085: Fixed ETWOONE-154: Added JSR107 Jar to WAR 9115: Fixed test: TransactionalCache uses LRU so repeatedly checking if a entry is there keeps it in the cache. 9206: Merged V2.2 to V2.9 8857: Improvements to ACL performance for large ACLs 8951: Always check permission entry changes are made at position 0 9219 <No change>: Made NTLMLogonDetails class Serializable, port of r8973. 9220: Added delete permission check when marking a file for delete on close. Port of r9075. 9222: Merged V2.1 to V2.9 8683: Early warning for nodes indexed in the wrong store (ACT-964) 8684: Enhanced tests 8685: Enhanced tests 8686: Additional tests 9223: Merged V2.2 to V2.9 9120: Merged V2.1 to V2.2 8740: Fix for AR-2173 - do no recheck case of the user name when validating tickets (it has been done) 9122: Additional unit test from support case. 9224: Merged V2.2 to V2.9 9076: Fixed ETWOTWO-426: Upgrading alfresco from 2.1.1 to 2.2 throws errors with Mysql 5.0.51 9104: Merged V2.1 to V2.2 9025: Fixed AR-2314, AR-2299: Optimizations after profiling 9105: Merged V2.1 to V2.2 8745: Fix AR-2233 (regression introduced by fix for AR-2221) 9121: Merged V2.1 to V2.2 9017: Fix index back up failing due to background index merge/deletions (inlcudes back port of CHK-2588) 9137: Incorporated additions from Will into AVM console (ETWOTWO-439) 9225: Merged V2.1 to V2.9 8641: Merged V2.1-A to V2.1 7729: Fix to Repository Web Service (queryAssociated) to allow reverse association lookup (ie. given target, get the source) 8673: Fix for AR-2098 - shorter URL form now has NTLM filter mapping example in web.xml 8682: Fix for AR-2005 8695: AR-2054. 8696: Improved sort test to include prefix form of field name 9226: Fix ALFCOM-994 (see also earlier change in r9223) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9233 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
161 lines
6.5 KiB
SQL
161 lines
6.5 KiB
SQL
--
|
|
-- Title: Update for permissions schema changes
|
|
-- Database: MySQL InnoDB
|
|
-- Since: V2.2 Schema 85
|
|
-- Author: Andy Hind
|
|
--
|
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
|
--
|
|
|
|
CREATE TABLE alf_acl_change_set (
|
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
|
version BIGINT NOT NULL,
|
|
primary key (id)
|
|
) ENGINE=InnoDB;
|
|
|
|
|
|
-- Add to ACL
|
|
ALTER TABLE alf_access_control_list
|
|
ADD COLUMN type INT NOT NULL DEFAULT 0,
|
|
ADD COLUMN latest BOOLEAN NOT NULL DEFAULT TRUE,
|
|
ADD COLUMN acl_id VARCHAR(36) NOT NULL DEFAULT 'UNSET',
|
|
ADD COLUMN acl_version BIGINT NOT NULL DEFAULT 1,
|
|
ADD COLUMN inherited_acl BIGINT,
|
|
ADD COLUMN is_versioned BOOLEAN NOT NULL DEFAULT FALSE,
|
|
ADD COLUMN requires_version BOOLEAN NOT NULL DEFAULT FALSE,
|
|
ADD COLUMN acl_change_set BIGINT,
|
|
ADD COLUMN inherits_from BIGINT;
|
|
CREATE INDEX fk_alf_acl_acs ON alf_access_control_list (acl_change_set);
|
|
ALTER TABLE alf_access_control_list ADD CONSTRAINT fk_alf_acl_acs FOREIGN KEY (acl_change_set) REFERENCES alf_acl_change_set (id);
|
|
CREATE INDEX idx_alf_acl_inh ON alf_access_control_list (inherits, inherits_from);
|
|
|
|
UPDATE alf_access_control_list acl
|
|
set acl_id = (acl.id);
|
|
|
|
ALTER TABLE alf_access_control_list
|
|
ADD UNIQUE (acl_id, latest, acl_version);
|
|
|
|
-- Create ACL member list
|
|
CREATE TABLE alf_acl_member (
|
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
|
version BIGINT NOT NULL,
|
|
acl_id BIGINT NOT NULL,
|
|
ace_id BIGINT NOT NULL,
|
|
pos INT NOT NULL,
|
|
primary key (id),
|
|
unique(acl_id, ace_id, pos)
|
|
) ENGINE=InnoDB;
|
|
CREATE INDEX fk_alf_aclm_acl ON alf_acl_member (acl_id);
|
|
ALTER TABLE alf_acl_member ADD CONSTRAINT fk_alf_aclm_acl FOREIGN KEY (acl_id) REFERENCES alf_access_control_list (id);
|
|
CREATE INDEX fk_alf_aclm_ace ON alf_acl_member (ace_id);
|
|
ALTER TABLE alf_acl_member ADD CONSTRAINT fk_alf_aclm_ace FOREIGN KEY (ace_id) REFERENCES alf_access_control_entry (id);
|
|
|
|
|
|
ALTER TABLE alf_access_control_entry DROP INDEX acl_id;
|
|
|
|
-- Extend ACE
|
|
ALTER TABLE alf_access_control_entry
|
|
ADD COLUMN auth_id BIGINT NOT NULL DEFAULT -1,
|
|
ADD COLUMN applies INT NOT NULL DEFAULT 0,
|
|
ADD COLUMN context_id BIGINT;
|
|
|
|
-- remove unused
|
|
DROP TABLE alf_auth_ext_keys;
|
|
|
|
-- remove authority constraint
|
|
ALTER TABLE alf_access_control_entry DROP INDEX FKFFF41F99B25A50BF, DROP FOREIGN KEY FKFFF41F99B25A50BF; -- (optional)
|
|
|
|
-- restructure authority
|
|
ALTER TABLE alf_authority
|
|
DROP PRIMARY KEY,
|
|
ADD COLUMN id BIGINT NOT NULL AUTO_INCREMENT,
|
|
ADD COLUMN crc BIGINT,
|
|
CHANGE recipient authority VARCHAR(100),
|
|
ADD primary key (id),
|
|
ADD UNIQUE (authority, crc);
|
|
CREATE INDEX idx_alf_auth_aut on alf_authority (authority);
|
|
|
|
-- migrate data - fix up FK refs to authority
|
|
UPDATE alf_access_control_entry ace
|
|
set auth_id = (select id from alf_authority a where a.authority = ace.authority_id);
|
|
|
|
|
|
-- migrate data - build equivalent ACL entries
|
|
INSERT INTO alf_acl_member (version, acl_id, ace_id, pos)
|
|
select 1, acl_id, id, 0 from alf_access_control_entry;
|
|
|
|
-- Create ACE context
|
|
CREATE TABLE alf_ace_context (
|
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
|
version BIGINT NOT NULL,
|
|
class_context VARCHAR(1024),
|
|
property_context VARCHAR(1024),
|
|
kvp_context VARCHAR(1024),
|
|
primary key (id)
|
|
) ENGINE=InnoDB;
|
|
|
|
|
|
-- Create auth aliases table
|
|
CREATE TABLE alf_authority_alias (
|
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
|
version BIGINT NOT NULL,
|
|
auth_id BIGINT NOT NULL,
|
|
alias_id BIGINT NOT NULL,
|
|
primary key (id),
|
|
UNIQUE (auth_id, alias_id)
|
|
) ENGINE=InnoDB;
|
|
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
|
ALTER TABLE alf_authority_alias ADD CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id);
|
|
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
|
ALTER TABLE alf_authority_alias ADD CONSTRAINT fk_alf_autha_aut FOREIGN KEY (auth_id) REFERENCES alf_authority (id);
|
|
|
|
|
|
-- Tidy up unused cols on ace table and add the FK contstraint back
|
|
-- finish take out of ACL_ID
|
|
ALTER TABLE alf_access_control_entry DROP INDEX FKFFF41F99B9553F6C, DROP FOREIGN KEY FKFFF41F99B9553F6C;
|
|
ALTER TABLE alf_access_control_entry DROP INDEX FKFFF41F9960601995, DROP FOREIGN KEY FKFFF41F9960601995;
|
|
ALTER TABLE alf_access_control_entry DROP COLUMN acl_id, DROP COLUMN authority_id;
|
|
ALTER TABLE alf_access_control_entry
|
|
CHANGE auth_id authority_id BIGINT NOT NULL;
|
|
CREATE INDEX fk_alf_ace_auth ON alf_access_control_entry (authority_id);
|
|
ALTER TABLE alf_access_control_entry ADD CONSTRAINT fk_alf_ace_auth FOREIGN KEY (authority_id) REFERENCES alf_authority (id);
|
|
CREATE INDEX fk_alf_ace_perm ON alf_access_control_entry (permission_id);
|
|
ALTER TABLE alf_access_control_entry ADD CONSTRAINT fk_alf_ace_perm FOREIGN KEY (permission_id) REFERENCES alf_permission (id);
|
|
CREATE INDEX fk_alf_ace_ctx ON alf_access_control_entry (context_id);
|
|
ALTER TABLE alf_access_control_entry ADD CONSTRAINT fk_alf_ace_ctx FOREIGN KEY (context_id) REFERENCES alf_ace_context (id);
|
|
|
|
|
|
|
|
-- Update members to point to the first use of an access control entry
|
|
UPDATE alf_acl_member mem
|
|
SET ace_id = (SELECT min(ace2.id) FROM alf_access_control_entry ace1
|
|
JOIN alf_access_control_entry ace2
|
|
ON ace1.permission_id = ace2.permission_id AND
|
|
ace1.authority_id = ace2.authority_id AND
|
|
ace1.allowed = ace2.allowed AND
|
|
ace1.applies = ace2.applies
|
|
WHERE ace1.id = mem.ace_id );
|
|
|
|
-- Remove duplicate aces the mysql way (as you can not use the deleted table in the where clause ...)
|
|
|
|
CREATE TABLE tmp_to_delete SELECT ace.id FROM alf_acl_member mem RIGHT OUTER JOIN alf_access_control_entry ace ON mem.ace_id = ace.id WHERE mem.ace_id IS NULL;
|
|
DELETE FROM alf_access_control_entry USING alf_access_control_entry JOIN tmp_to_delete t ON alf_access_control_entry.id = t.id;
|
|
DROP TABLE tmp_to_delete;
|
|
|
|
-- Add constraint for duplicate acls
|
|
|
|
ALTER TABLE alf_access_control_entry
|
|
ADD UNIQUE (permission_id, authority_id, allowed, applies, context_id);
|
|
|
|
--
|
|
-- Record script finish
|
|
--
|
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-ACL';
|
|
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-ACL', 'Manually executed script upgrade V2.2: Update acl schema',
|
|
0, 119, -1, 120, null, 'UNKOWN', 1, 1, 'Script completed'
|
|
);
|