Several fixes for upgrades (for Oracle).

git-svn-id: https://svn.libreccm.org/ccm/trunk@3044 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-12-12 18:38:55 +00:00
parent 86a18a3b32
commit 95f1b08a37
4 changed files with 23 additions and 26 deletions

View File

@ -50,25 +50,23 @@ public abstract class AbstractBundleUpgrade {
System.out.printf("Creating new table %s...\n", getBundleTableName()); System.out.printf("Creating new table %s...\n", getBundleTableName());
final Statement stmt = conn.createStatement(); final Statement stmt = conn.createStatement();
stmt.addBatch(String.format("CREATE TABLE %s ( " String createTable = String.format("CREATE TABLE %s ( bundle_id integer NOT NULL)",
+ "bundle_id integer NOT NULL);", getBundleTableName());
getBundleTableName())); System.out.println(createTable);
stmt.execute(createTable);
stmt.addBatch(String.format("ALTER TABLE ONLY %s " String primaryKey = String.format("ALTER TABLE %s ADD CONSTRAINT %s PRIMARY KEY (bundle_id)",
+ "ADD CONSTRAINT %s "
+ "PRIMARY KEY (bundle_id);",
getBundleTableName(), getBundleTableName(),
getPrimaryKeyConstraintName())); getPrimaryKeyConstraintName());
System.out.println(primaryKey);
stmt.execute(primaryKey);
stmt.addBatch(String.format("ALTER TABLE ONLY %s " String foreignKey = String.format("ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (bundle_id) REFERENCES %s(bundle_id)",
+ "ADD CONSTRAINT %s "
+ "FOREIGN KEY (bundle_id) "
+ "REFERENCES %s(bundle_id);",
getBundleTableName(), getBundleTableName(),
getBundleContraintName(), getBundleContraintName(),
getSuperBundleTable())); getSuperBundleTable());
System.out.println(foreignKey);
stmt.executeBatch(); stmt.execute(foreignKey);
} catch (SQLException ex) { } catch (SQLException ex) {
System.err.printf("Failed to create table %s.\n", System.err.printf("Failed to create table %s.\n",

View File

@ -49,7 +49,7 @@ public class RelationAttributeACSObject extends Program {
final Statement stmt = connection.createStatement(); final Statement stmt = connection.createStatement();
final ResultSet result = stmt.executeQuery( final ResultSet result = stmt.executeQuery(
"SELECT attribute, attr_key, lang, name, description FROM cms_relation_attribute;"); "SELECT attribute, attr_key, lang, name, description FROM cms_relation_attribute");
while (result.next()) { while (result.next()) {
final RelationAttributeEntry entry = new RelationAttributeEntry(); final RelationAttributeEntry entry = new RelationAttributeEntry();
@ -63,19 +63,19 @@ public class RelationAttributeACSObject extends Program {
System.out.printf("Found %d RelationAttributes entries.\n", entries.size()); System.out.printf("Found %d RelationAttributes entries.\n", entries.size());
stmt.addBatch("ALTER TABLE cms_relation_attribute DROP CONSTRAINT cms_rel_att_att_key_at_u_nh3g1"); stmt.addBatch("ALTER TABLE cms_relation_attribute DROP CONSTRAINT cms_rel_att_att_key_at_u_nh3g1");
stmt.addBatch("DROP TABLE cms_relation_attribute;"); stmt.addBatch("DROP TABLE cms_relation_attribute");
stmt.addBatch("CREATE TABLE cms_relation_attribute (object_id integer NOT NULL," stmt.addBatch("CREATE TABLE cms_relation_attribute (object_id integer NOT NULL,"
+ "attribute character varying(100) NOT NULL," + "attribute character varying(100) NOT NULL,"
+ "attr_key character varying(100) NOT NULL," + "attr_key character varying(100) NOT NULL,"
+ "lang character varying(2) NOT NULL," + "lang character varying(2) NOT NULL,"
+ "name character varying(100) NOT NULL," + "name character varying(100) NOT NULL,"
+ "description character varying(500))"); + "description character varying(500))");
stmt.addBatch("ALTER TABLE ONLY cms_relation_attribute " stmt.addBatch("ALTER TABLE cms_relation_attribute "
+ " ADD CONSTRAINT cms_rela_attrib_obj_id_p_qdgsr PRIMARY KEY (object_id);"); + " ADD CONSTRAINT cms_rela_attrib_obj_id_p_qdgsr PRIMARY KEY (object_id)");
stmt.addBatch("ALTER TABLE ONLY cms_relation_attribute " stmt.addBatch("ALTER TABLE cms_relation_attribute "
+ "ADD CONSTRAINT cms_rel_att_att_key_at_u_nh3g1 UNIQUE (attribute, attr_key, lang);"); + "ADD CONSTRAINT cms_rel_att_att_key_at_u_nh3g1 UNIQUE (attribute, attr_key, lang)");
stmt.addBatch("ALTER TABLE ONLY cms_relation_attribute " stmt.addBatch("ALTER TABLE cms_relation_attribute "
+ "ADD CONSTRAINT cms_rela_attrib_obj_id_f_23qc3 FOREIGN KEY (object_id) REFERENCES acs_objects(object_id);"); + "ADD CONSTRAINT cms_rela_attrib_obj_id_f_23qc3 FOREIGN KEY (object_id) REFERENCES acs_objects(object_id)");
stmt.executeBatch(); stmt.executeBatch();

View File

@ -26,6 +26,5 @@ update application_types
set object_type = 'com.arsdigita.navigation.portlet.NavigationTreePortlet', set object_type = 'com.arsdigita.navigation.portlet.NavigationTreePortlet',
title = 'Navigation Tree', title = 'Navigation Tree',
description = 'Displays a tree of navigation categories' description = 'Displays a tree of navigation categories'
set (object_type,title,description) =
where object_type like 'com.arsdigita.portalworkspace.portlet.NavigationDirectoryPortlet' ; where object_type like 'com.arsdigita.portalworkspace.portlet.NavigationDirectoryPortlet' ;

View File

@ -14,5 +14,5 @@
-- along with this library; if not, write to the Free Software Foundation, Inc., -- along with this library; if not, write to the Free Software Foundation, Inc.,
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ /default/6.5.2-6.5.3/add-flash-portlet.sql @@ default/6.5.2-6.5.3/add-flash-portlet.sql