Navigation Menu

Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Add 5.1 to 5.2 sql
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Jan 12, 2015
1 parent 402a219 commit d95d223
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions update/database/ezpublish/5.2/dbupdate-5.1.0-to-5.2.0.sql
@@ -1,3 +1,50 @@

-- Start ezp-21465 : Cleanup extra lines in the ezurl_object_link table
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE ezurl_object_link_temp';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
/

CREATE GLOBAL TEMPORARY TABLE ezurl_object_link_temp ON COMMIT PRESERVE ROWS AS
SELECT DISTINCT contentobject_attribute_id, contentobject_attr_version, url_id
FROM ezurl_object_link T1 JOIN ezcontentobject_attribute ON T1.contentobject_attribute_id = ezcontentobject_attribute.id
WHERE ezcontentobject_attribute.data_type_string = 'ezurl'
AND T1.url_id < ANY
(SELECT DISTINCT T2.url_id
FROM ezurl_object_link T2
WHERE T1.url_id < T2.url_id
AND T1.contentobject_attribute_id = T2.contentobject_attribute_id
AND T1.contentobject_attr_version = T2.contentobject_attr_version);

DELETE FROM ezurl_object_link
WHERE EXISTS (
SELECT url_id
FROM ezurl_object_link_temp
WHERE ezurl_object_link.url_id = ezurl_object_link_temp.url_id
AND ezurl_object_link.contentobject_attribute_id = ezurl_object_link_temp.contentobject_attribute_id
AND ezurl_object_link.contentobject_attr_version = ezurl_object_link_temp.contentobject_attr_version
);
-- End ezp-21465

-- Start EZP-21469
-- While using the public API, ezcontentobject.language_mask was not updated correctly,
-- the UPDATE statement below fixes that based on the language_mask of the current version.
UPDATE ezcontentobject o
SET language_mask = (
SELECT bitor(bitand(o.language_mask, 1), bitand(v.language_mask, 1))
FROM ezcontentobject_version v
WHERE o.id = v.contentobject_id AND o.current_version = v.version
)
WHERE EXISTS(
SELECT *
FROM ezcontentobject_version
WHERE o.id = ezcontentobject_version.contentobject_id
AND o.current_version = ezcontentobject_version.version
);
-- End EZP-21469

-- Start EZP-21648:
-- Adding 'priority' and 'is_hidden' columns to the 'eznode_assignment' table
ALTER TABLE eznode_assignment ADD priority integer DEFAULT 0 NOT NULL;
Expand Down

0 comments on commit d95d223

Please sign in to comment.