Files
alfresco-community-repo/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
Derek Hulley 5b6ff13d94 Merged V3.1 to HEAD
14192: Support for variable assignment and replacement in upgrade scripts
   14263 (RECORD ONLY)
   14286: Merged V2.2 to V3.1
      14124: Fixed ETWOTWO-961: FileFolderService.listFolders throws UnsupportedOperationException for AVM nodes
      14277: Fixed ETWOTWO-1228: CLONE -NodeService properties don't support collections of collections for d:any
   14302: Merged DEV/V3.1_UPGRADE_SCRIPTS_2 to V3.1: DB2 scripts and other minor changes
      14126 (RECORD ONLY)
      14193 (RECORD ONLY)
      14205: Next version of DB upgrade scripts for SQLServer and DB2
      14208: Enterprise DB scripts review: Move scripts to correct locations as a first pass
      14211: Carried V2.1-A script change into branch; use STR() function for numeric to string comparison
      14212: Moved script from old SQLServer dialect directory
      14213: Minor script formatting
   14303: Merged DEV/V3.1_UPGRADE_SCRIPTS_2 to V3.1: DB2 scripts and other formatting
      14214: Removed redundant scripts; these are all covered by generic scripts
      14236: Format SQL
      14248: Formatting of SQL to produce meaningful diffs
      14266: Next version of upgrade scripts
      14281: Clean up formatting of SQL scripts using Convert utility
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/DEV/V3.1_UPGRADE_SCRIPTS_2:r14126,14193,14205,14208,14211-14213
      Merged /alfresco/BRANCHES/V2.2:r14124,14130,14277
      Merged /alfresco/BRANCHES/V3.1:r14192,14263,14286,14302-14303


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14652 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-06-11 10:30: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-2';
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-2', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
0, 2005, -1, 2006, null, 'UNKOWN', 1, 1, 'Script completed'
);