Files
alfresco-community-repo/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoSchemaUpdate-2.2-CleanNodeStatuses.sql
Dave Ward 3feaed5d5a Merged V3.3-BUG-FIX to HEAD
21384: ALF-2879: XAM Connector changes
      - Added callbacks for code to modify the XSet fields
      - Changed XAMArchivedAspect to use callback (moved code out of XAMContentStore)
      - Added XAMNodePropertyWriter to set metadata including some global properties and node-specific values
      - See readme.txt for details
   21393: ALF-2879: XAM Connector changes
      - Sprinkled DEBUG logging around
      - Updated readme.txt with logging details
      - Metadata writing tested and no changes required
   21403: ALF-2879: XAM Connector changes
      - Workaround ContentStoreSelector bug present in V3.3.2 - NodeRef context not present during write
      - Added bug back into ContentStoreSelector for testing and verified that metadata is written to XSet
   21487: Merged V3.3 to V3.3-BUG-FIX
      21374: ALF-4028: In "createNode", save the ScriptNode before calling cmis.applyVersioningState to ensure updated properties have been saved.
      21389: Add main to run index check against current repository by hand
      21390: ALF-4016: Files uploaded to ts are not visible
         - multi-threaded tracking never abandons an index chunk
         - warns of long running transaction chunks
         - logging change
      21392: ALF-4016: Files uploaded to ts are not visible
         - make sure FTS update exceptions can not lead to a TX commit and deletions
      21428: NFS fixes to return the current file size in the post op attributes if the file is open, fixes to rename to close the current file if open before the rename, also delete the target file for a rename if it exists as per NFS v3 spec. ALF-3181, ALF-3954, ALF-3955, ALF-3956, ALF-3957.
      21443: Merged PATCHES/V3.2.1 to V3.3
         21396: ALF-3779, ALF-4025: Corrected driving column in alf_node_status --FOREACH statement to handle null node_ids and added --FOREACH for building of t_summary_nstat
      21455: Remove old language pack pieces
      21458: Fix linux install for some distros (ALF-4000)
      21467: Merged DEV/TEMPORARY to V3.3
         21444: ALF-3962 : Message 'The current implementation of the version service does not support the creation of branches.' being thrown from Version2ServiceImpl
            1. Change AbstractVersionServiceImpl.invokeCalculateVersionLabel to make SerialVersionLabelPolicy behaviour default rather than the versionNumber when calculating new version label. 
            2. Change Version2ServiceImpl to handle any existing corrupted version histories that are marked with version label "0" (see Version2ServiceImpl. checkForCorruptedVersions method). 
            3. Unit tests was updated.
         21464: Reimplemented according to David's review.
            1. Update logic of checkForCorruptedVersions method in Version2ServiceImpl. A reusable protected method (getAllVersions) was created containing the shared code.
            2. Update unit test to include tests for the corrupt version fixing behaviour.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2010-07-29 13:10:48 +00:00

77 lines
2.8 KiB
SQL

--
-- Title: Clean duplicate alf_node_status entries
-- Database: MySQL
-- Since: V3.1 schema 1011
-- Author: Derek Hulley
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- Cleans out duplicate alf_node_status entries for V2.1 installations.
-- This script does not need to run if the server has already been upgraded to schema 90 or later
CREATE TABLE t_node_status
(
node_id INTEGER NOT NULL,
transaction_id BIGINT(20) NOT NULL,
PRIMARY KEY (node_id)
);
--FOREACH alf_node_status.node_id system.upgrade.t_node_status.batchsize
INSERT INTO t_node_status
(
SELECT c.node_id, c.transaction_id FROM
(
SELECT COUNT(node_id) x, ns.node_id, ns.transaction_id FROM alf_node_status ns
WHERE node_id >= ${LOWERBOUND} AND node_id <= ${UPPERBOUND}
GROUP BY node_id
) c
WHERE c.x > 1
);
--FOREACH alf_node_status.node_id system.upgrade.alf_node_status.batchsize
DELETE FROM alf_node_status
WHERE node_id IN (SELECT node_id FROM t_node_status)
AND node_id >= ${LOWERBOUND} AND node_id <= ${UPPERBOUND};
--FOREACH t_node_status.node_id system.upgrade.alf_node_status.batchsize
INSERT INTO alf_node_status (protocol, identifier, guid, node_id, transaction_id, version)
(
SELECT n.protocol, n.identifier, n.uuid, n.id, tns.transaction_id, 0
FROM t_node_status tns JOIN alf_node n ON (n.id = tns.node_id)
WHERE tns.node_id >= ${LOWERBOUND} AND tns.node_id <= ${UPPERBOUND}
);
DROP TABLE t_node_status;
--FOREACH alf_transaction.id system.upgrade.alf_transaction.batchsize
DELETE FROM alf_node_status
WHERE node_id IS NULL
AND transaction_id >= ${LOWERBOUND} AND transaction_id <= ${UPPERBOUND};
--FOREACH alf_node_status.node_id system.upgrade.alf_node_status.batchsize
UPDATE alf_node_status ns SET ns.protocol =
(
SELECT n.protocol FROM alf_node n
WHERE n.id = ns.node_id
)
WHERE ns.node_id >= ${LOWERBOUND} AND ns.node_id <= ${UPPERBOUND};
--FOREACH alf_transaction.id system.upgrade.alf_transaction.batchsize
DELETE
alf_transaction
FROM
alf_transaction
LEFT JOIN alf_node_status ON (alf_node_status.transaction_id = alf_transaction.id)
WHERE
alf_node_status.node_id is null
AND alf_transaction.id >= ${LOWERBOUND} AND alf_transaction.id <= ${UPPERBOUND};
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-CleanNodeStatuses';
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-CleanNodeStatuses', 'Manually executed script upgrade V2.2: Clean alf_node_status table',
0, 89, -1, 90, null, 'UNKOWN', ${true}, ${true}, 'Script completed'
);