From d8893d77ebdb03639d5b04f9e9602e8b8ba52a96 Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 29 Oct 2013 18:37:34 +0000 Subject: [PATCH] Upgrade Script for converting all HTMLForm items into Article items and removing the HTMLForm content type (which is complelelty identifical with the article content type. git-svn-id: https://svn.libreccm.org/ccm/trunk@2400 8810af33-2d31-482b-a856-94f89814c4df --- .../upgrade/0.0.0-6.6.1/remove_htmlform.sql | 55 +++++++++++++++++++ .../sql/upgrade/oracle-se-0.0.0-6.6.1.sql | 22 ++++++++ .../sql/upgrade/postgres-0.0.0-6.6.1.sql | 26 +++++++++ ccm-ldn-aplaws/src/ccm-ldn-aplaws.upgrade | 5 ++ 4 files changed, 108 insertions(+) create mode 100644 ccm-ldn-aplaws/sql/default/upgrade/0.0.0-6.6.1/remove_htmlform.sql create mode 100644 ccm-ldn-aplaws/sql/upgrade/oracle-se-0.0.0-6.6.1.sql create mode 100644 ccm-ldn-aplaws/sql/upgrade/postgres-0.0.0-6.6.1.sql create mode 100644 ccm-ldn-aplaws/src/ccm-ldn-aplaws.upgrade diff --git a/ccm-ldn-aplaws/sql/default/upgrade/0.0.0-6.6.1/remove_htmlform.sql b/ccm-ldn-aplaws/sql/default/upgrade/0.0.0-6.6.1/remove_htmlform.sql new file mode 100644 index 000000000..5656f0726 --- /dev/null +++ b/ccm-ldn-aplaws/sql/default/upgrade/0.0.0-6.6.1/remove_htmlform.sql @@ -0,0 +1,55 @@ +-- +-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id$ + +-- Converts all HTMLForm content items to Article content items. + +-- Remove the inizalizer for HTMLForm for inits and inits_requirements +DELETE FROM init_requirements WHERE required_init = 'com.arsdigita.cms.contenttypes.HTMLFormInitializer' + OR init = 'com.arsdigita.cms.contenttypes.HTMLFormInitializer'; +DELETE FROM inits WHERE class_name = 'com.arsdigita.cms.contenttypes.HTMLFormInitializer'; + +INSERT INTO ct_articles (item_id, lead) VALUES (SELECT item_id, lead FROM ct_htmlform); +UPDATE cms_items + SET type_id = (SELECT type_id FROM content_types WHERE object_type = 'com.arsdigita.cms.contenttypes.Article') + WHERE type_id = (SELECT type_id FROM content_types WHERE object_type = 'com.arsdigita.cms.contenttypes.HTMLForm'); + +UPDATE acs_objects + SET object_type = 'com.arsdigita.cms.contenttypes.Article', + default_domain_class = 'com.arsdigita.cms.contenttypes.Article' + WHERE object_type = 'com.arsdigita.cms.contenttypes.HTMLForm'; + +UPDATE lucene_docs + SET type = 'com.arsdigita.cms.contenttypes.Article' + WHERE type = 'com.arsdigita.cms.contenttypes.HTMLForm'; + +UPDATE vcx_generic_operations + SET value = replace(value, 'com.arsdigita.cms.contenttypes.HTMLForm', 'com.arsdigita.cms.contenttypes.Article') + WHERE value LIKE '%com.arsdigita.cms.contenttypes.HTMLForm%'; + +UPDATE vcx_obj_changes + SET obj_id = REPLACE(obj_id, 'com.arsdigita.cms.contenttypes.HTMLForm', 'com.arsdigita.cms.contenttypes.Article') + WHERE obj_id LIKE '%com.arsdigita.cms.contenttypes.HTMLForm%'; + +UPDATE vcx_tags + SET tagged_oid = REPLACE(tagged_oid,'com.arsdigita.cms.contenttypes.HTMLForm', 'com.arsdigita.cms.contenttypes.Article') + WHERE tagged_oid LIKE '%com.arsdigita.cms.contenttypes.HTMLForm%'; + +DELETE FROM content_types WHERE object_type = 'com.arsdigita.cms.contenttypes.HTMLForm'; + +DROP TABLE IF EXISTS ct_htmlform; \ No newline at end of file diff --git a/ccm-ldn-aplaws/sql/upgrade/oracle-se-0.0.0-6.6.1.sql b/ccm-ldn-aplaws/sql/upgrade/oracle-se-0.0.0-6.6.1.sql new file mode 100644 index 000000000..43fdbe5b6 --- /dev/null +++ b/ccm-ldn-aplaws/sql/upgrade/oracle-se-0.0.0-6.6.1.sql @@ -0,0 +1,22 @@ +-- +-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id$ + +-- Remove the inizalizer for HTMLForm for inits and inits_requirements + +@@ ../default/upgrade/0.0.0-6.6.1/remove_htmlform.sql \ No newline at end of file diff --git a/ccm-ldn-aplaws/sql/upgrade/postgres-0.0.0-6.6.1.sql b/ccm-ldn-aplaws/sql/upgrade/postgres-0.0.0-6.6.1.sql new file mode 100644 index 000000000..042d87d77 --- /dev/null +++ b/ccm-ldn-aplaws/sql/upgrade/postgres-0.0.0-6.6.1.sql @@ -0,0 +1,26 @@ +-- +-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id$ + +-- Remove the inizalizer for HTMLForm for inits and inits_requirements + +begin; + +\i ../default/upgrade/0.0.0-6.6.1/remove_htmlform.sql + +commit; \ No newline at end of file diff --git a/ccm-ldn-aplaws/src/ccm-ldn-aplaws.upgrade b/ccm-ldn-aplaws/src/ccm-ldn-aplaws.upgrade new file mode 100644 index 000000000..4d07f3510 --- /dev/null +++ b/ccm-ldn-aplaws/src/ccm-ldn-aplaws.upgrade @@ -0,0 +1,5 @@ + + +