You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2011/09/26 17:10:19 UTC

svn commit: r1175900 - in /incubator/wookie/trunk/scripts/migration: ./ 0.9.0->0.9.1/ 0.9.0->0.9.1/mysql5.sql

Author: scottbw
Date: Mon Sep 26 15:10:19 2011
New Revision: 1175900

URL: http://svn.apache.org/viewvc?rev=1175900&view=rev
Log:
Adding MySQL5 migration script for 0.9.0 to 0.9.1. See WOOKIE-237.

Added:
    incubator/wookie/trunk/scripts/migration/
    incubator/wookie/trunk/scripts/migration/0.9.0->0.9.1/
    incubator/wookie/trunk/scripts/migration/0.9.0->0.9.1/mysql5.sql

Added: incubator/wookie/trunk/scripts/migration/0.9.0->0.9.1/mysql5.sql
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/scripts/migration/0.9.0-%3E0.9.1/mysql5.sql?rev=1175900&view=auto
==============================================================================
--- incubator/wookie/trunk/scripts/migration/0.9.0->0.9.1/mysql5.sql (added)
+++ incubator/wookie/trunk/scripts/migration/0.9.0->0.9.1/mysql5.sql Mon Sep 26 15:10:19 2011
@@ -0,0 +1,78 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# MySQL5 database migration script for Apache Wookie (incubating) 0.9.1
+#
+# This script updates a database created with version 0.9.0 of Wookie
+# to work with version 0.9.1. Always use a clone of your database and not the 
+# live version when performing migration.
+#
+
+# ----------------------------------------------------------------------- 
+# ServerFeature has been removed in 0.9.1; instead, features are loaded
+# directly from XML into memory.
+# ----------------------------------------------------------------------- 
+
+DROP TABLE IF EXISTS ServerFeature;
+
+
+# ----------------------------------------------------------------------- 
+# Author has been moved from part of Widget into a separate class. This
+# means we create a new table, copy the data over from Widget, and then
+# modify the Widget table to remove the Author columns
+# ----------------------------------------------------------------------- 
+DROP TABLE IF EXISTS Author;
+
+CREATE TABLE Author
+(
+    id INTEGER NOT NULL,
+    jpa_version INTEGER,
+    author VARCHAR(255)  NULL,
+    email VARCHAR(255)  NULL,
+    href VARCHAR(255)  NULL,
+    lang VARCHAR(255) NULL,
+    dir VARCHAR(255) NULL,
+    widget_id INTEGER,
+    PRIMARY KEY (id)
+) ;
+
+CREATE INDEX IXAuthor1 ON Author (widget_id);
+
+INSERT INTO Author (id, jpa_version, widget_id, author, email, href) SELECT id, 1, id, widget_author, widget_author_email, widget_author_href FROM Widget;
+
+ALTER TABLE Widget DROP COLUMN widget_author;
+ALTER TABLE Widget DROP COLUMN widget_author_email;
+ALTER TABLE Widget DROP COLUMN widget_author_href;
+
+# ----------------------------------------------------------------------- 
+# Some new properties have been added to Widget, to support localisation,
+# widget updates, and connecting a widget with its original installation
+# .wgt package
+# ----------------------------------------------------------------------- 
+
+ALTER TABLE Widget ADD COLUMN package_path VARCHAR(255) NULL;
+ALTER TABLE Widget ADD COLUMN default_locale VARCHAR(255) NULL;
+ALTER TABLE Widget ADD COLUMN update_location MEDIUMTEXT NULL;
+ALTER TABLE Widget ADD COLUMN dir VARCHAR(255) NULL;
+ALTER TABLE Widget ADD COLUMN lang VARCHAR(255) NULL;
+
+# ----------------------------------------------------------------------- 
+# Participant no longer connects directly to Widget, but is instead 
+# connected by the shared data key.
+# ----------------------------------------------------------------------- 
+
+ALTER TABLE Participant DROP INDEX IXParticipant1;
+ALTER TABLE Participant DROP FOREIGN KEY FKParticipant1;
+ALTER TABLE Participant DROP COLUMN widget_id;
\ No newline at end of file