Files
alfresco-community-repo/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
Dave Ward 04c877b808 Merged V3.2 to HEAD
16187: Merged V3.1 to V3.2
      16185: AbstractLuceneIndexerAndSearcherFactory.getTransactionId() must return null when there is no transaction
   16171: Merged V3.1 to V3.2
      16168: ETHREEOH-2797: Force patch.db-V2.2-Person to apply one more time to fix up corrupt users created by LDAP Import
         - Problem due to ETHREEOH-2023, fixed in 3.1.1
         - Also corrects ldap.synchronisation.defaultHomeFolderProvider to be userHomesHomeFolderProvider
         - Also requires fix to ETHREEOH-2475 to fix up duplicate users
      16167: ETHREEOH-2475: Fixed nested transaction handling in AbstractLuceneIndexerAndSearcherFactory to allow duplicate user processing in PersonServiceImpl to actually work


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16363 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-09-18 10:52:57 +00:00

68 lines
2.2 KiB
SQL

--
-- Title: Move user name to be part of the association QNAME
-- Database: Generic
-- Since: V2.2 Schema 91
-- Author: Andy Hind
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- Path was previously unused and unindex - new we use it the index is required.
UPDATE
alf_child_assoc
SET
qname_ns_id =
(
SELECT
id
FROM
alf_namespace n
WHERE
n.uri = 'http://www.alfresco.org/model/content/1.0'
),
qname_localname =
(
SELECT
LOWER(p.string_value)
FROM
alf_node_properties p
JOIN alf_qname q on p.qname_id = q.id
JOIN alf_namespace n on q.ns_id = n.id
WHERE
p.node_id = alf_child_assoc.child_node_id AND
q.local_name ='userName' AND
n.uri = 'http://www.alfresco.org/model/content/1.0'
)
WHERE exists
(
SELECT
0
FROM alf_node_properties pp
JOIN alf_qname qq on pp.qname_id = qq.id
JOIN alf_namespace nn on qq.ns_id = nn.id
WHERE
pp.node_id = alf_child_assoc.child_node_id AND
qq.local_name ='userName' AND
nn.uri = 'http://www.alfresco.org/model/content/1.0'
)
;
-- Validation query
-- select count(*) from alf_child_assoc c
-- JOIN alf_node_properties pp ON c.child_node_id = pp.node_id AND c.qname_localname = pp.string_value
-- JOIN alf_qname qq on pp.qname_id = qq.id
-- JOIN alf_namespace nn on qq.ns_id = nn.id AND c.qname_ns_id = nn.id
-- WHERE qq.local_name ='userName' AND nn.uri = 'http://www.alfresco.org/model/content/1.0'
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-Person-3';
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-Person-3', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
0, 3002, -1, 3003, null, 'UNKOWN', 1, 1, 'Script completed'
);