roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r279136 - in /incubator/roller/branches/roller_2.0: ./ metadata/database/ metadata/database/hibernate/ src/org/roller/business/utils/ src/org/roller/presentation/weblog/actions/ src/org/roller/presentation/website/actions/ src/org/roller/util/
Date Tue, 06 Sep 2005 21:51:17 GMT
Author: snoopdave
Date: Tue Sep  6 14:50:59 2005
New Revision: 279136

URL: http://svn.apache.org/viewcvs?rev=279136&view=rev
Log:
Added database 1.3 to 2.0 upgrade code, plus (untested) Derby support

Added:
    incubator/roller/branches/roller_2.0/metadata/database/120-to-200-migration-raw.sql
    incubator/roller/branches/roller_2.0/metadata/database/db_db2.properties
    incubator/roller/branches/roller_2.0/metadata/database/db_derby.properties
Removed:
    incubator/roller/branches/roller_2.0/metadata/database/130-to-200-migration-raw.sql
Modified:
    incubator/roller/branches/roller_2.0/.classpath
    incubator/roller/branches/roller_2.0/build.xml
    incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql
    incubator/roller/branches/roller_2.0/metadata/database/db_hsql.properties
    incubator/roller/branches/roller_2.0/metadata/database/db_mysql.properties
    incubator/roller/branches/roller_2.0/metadata/database/db_postgresql.properties
    incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml
    incubator/roller/branches/roller_2.0/metadata/database/rollerdb.properties
    incubator/roller/branches/roller_2.0/properties.xmlf
    incubator/roller/branches/roller_2.0/src/org/roller/business/utils/UpgradeDatabase.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserBaseAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java

Modified: incubator/roller/branches/roller_2.0/.classpath
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/.classpath?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/.classpath (original)
+++ incubator/roller/branches/roller_2.0/.classpath Tue Sep  6 14:50:59 2005
@@ -1,70 +1,88 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="sandbox/standalone/src"/>
-	<classpathentry kind="src" path="sandbox/standalone/tests"/>
-	<classpathentry kind="src" path="sandbox/planetroller/test"/>
-	<classpathentry kind="src" path="sandbox/planetroller/src"/>
-	<classpathentry kind="src" path="tests"/>
 	<classpathentry kind="src" path="build/generated/src.business"/>
 	<classpathentry kind="src" path="build/generated/src.presentation"/>
-	<classpathentry kind="src" path="contrib/plugins/src"/>
 	<classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/activation.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/cglib-full-2.0.1.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-beanutils.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-betwixt-1.0-beta-1.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-codec-1.1.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-collections.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-digester.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-logging.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/commons-validator.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/concurrent-1.3.2.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/dom4j-1.4.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/ehcache-0.7.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/hibernate2.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/jakarta-oro.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/jaxen-full.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/jazzy-core.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/jstl.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/log4j-1.2.4.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/lucene-1.4.3.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/mail.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/odmg-3.0.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/proxool-0.8.3.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/rollerbeans.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/rome-0.6.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/rome-fetcher-0.6.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/standard.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/struts-el.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/struts.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/taglibs-string.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/velocity-1.4.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/velocity-dep-1.4.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/velocity-tools-1.1.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/xalan-2.4.0.jar"/>
+	<classpathentry kind="lib" path="C:/eclipse/blog-workspace/roller_2.0/build/roller/WEB-INF/lib/xmlrpc-2.0.jar"/>
+	<classpathentry kind="lib" path="tools/buildtime/tomcat-5.0.28/jsp-api.jar"/>
+	<classpathentry kind="lib" path="tools/buildtime/tomcat-5.0.28/servlet-api.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/c3p0-0.8.4.5.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/cglib-full-2.0.1.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/dom4j-1.4.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/ehcache-0.7.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/jdom.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/jta.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/odmg-3.0.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/proxool-0.8.3.jar"/>
+	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/xalan-2.4.0.jar"/>
+	<classpathentry kind="lib" path="tools/lib/activation.jar"/>
+	<classpathentry kind="lib" path="tools/lib/commons-betwixt-1.0-beta-1.jar"/>
+	<classpathentry kind="lib" path="tools/lib/commons-codec-1.1.jar"/>
+	<classpathentry kind="lib" path="tools/lib/commons-httpclient-2.0.2.jar"/>
+	<classpathentry kind="lib" path="tools/lib/concurrent-1.3.2.jar"/>
+	<classpathentry kind="lib" path="tools/lib/ekitapplet.jar"/>
 	<classpathentry kind="lib" path="tools/lib/jazzy-core.jar"/>
 	<classpathentry kind="lib" path="tools/lib/log4j-1.2.4.jar"/>
-	<classpathentry kind="lib" path="tools/lib/commons-betwixt-1.0-beta-1.jar"/>
-	<classpathentry kind="lib" path="tools/lib/activation.jar"/>
+	<classpathentry kind="lib" path="tools/lib/lucene-1.4.3.jar"/>
 	<classpathentry kind="lib" path="tools/lib/mail.jar"/>
-	<classpathentry kind="lib" path="tools/lib/concurrent-1.3.2.jar"/>
 	<classpathentry kind="lib" path="tools/lib/mm.mysql-2.0.14-bin.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/strutstest-2.0.0.jar"/>
-	<classpathentry kind="lib" path="contrib/lib/jython.jar"/>
-	<classpathentry kind="lib" path="contrib/lib/JSPWiki.jar"/>
-	<classpathentry kind="lib" path="contrib/lib/radeox.jar"/>
-	<classpathentry kind="lib" path="tools/lib/commons-codec-1.1.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/tomcat-4.1.24/servlet-api.jar"/>
-	<classpathentry sourcepath="C:/java/lib/hibernate-2.1.4/src" kind="lib" path="tools/hibernate-2.1/hibernate2.jar"/>
-	<classpathentry kind="lib" path="tools/standard-1.0.3/lib/jstl.jar"/>
-	<classpathentry kind="lib" path="tools/standard-1.0.3/lib/standard.jar"/>
-	<classpathentry kind="lib" path="contrib/lib/textile4j-1.20.jar"/>
+	<classpathentry kind="lib" path="tools/lib/rome-0.6.jar"/>
+	<classpathentry kind="lib" path="tools/lib/rome-fetcher-0.6.jar"/>
+	<classpathentry kind="lib" path="tools/lib/taglibs-string.jar"/>
+	<classpathentry kind="lib" path="tools/lib/velocity-1.4.jar"/>
+	<classpathentry kind="lib" path="tools/lib/velocity-dep-1.4.jar"/>
+	<classpathentry kind="lib" path="tools/lib/velocity-tools-1.1.jar"/>
+	<classpathentry kind="lib" path="tools/lib/xmlrpc-1.2-b1.jar"/>
+	<classpathentry kind="lib" path="tools/lib/xmlrpc-2.0.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/antlr.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-beanutils.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-collections.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-digester.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-fileupload.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-lang-2.0.jar"/>
+	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-logging.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-validator.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/jakarta-oro.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/struts.jar"/>
 	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/struts-el.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/ant-1.6.2/ant.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/hsqldb.jar"/>
-	<classpathentry sourcepath="/Applications/Java/velocity-tools-1.1-src/src/java" kind="lib" path="tools/lib/velocity-tools-1.1.jar"/>
-	<classpathentry sourcepath="/Applications/Java/velocity-1.4/src/java" kind="lib" path="tools/lib/velocity-dep-1.4.jar"/>
-	<classpathentry kind="lib" path="tools/lib/velocity-1.4.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/xalan-2.4.0.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/proxool-0.8.3.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/odmg-3.0.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/jta.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/ehcache-0.7.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/dom4j-1.4.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/cglib-full-2.0.1.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/c3p0-0.8.4.5.jar"/>
-	<classpathentry kind="lib" path="tools/hibernate-2.1/lib/jdom.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/xmlParserAPIs-2.3.0.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/xercesImpl-2.3.0.jar"/>
-	<classpathentry kind="lib" path="tools/standard-1.0.3/lib/jaxen-full.jar"/>
-	<classpathentry sourcepath="/rome" kind="lib" path="tools/lib/rome-0.6.jar"/>
-	<classpathentry kind="lib" path="tools/struts-1.2.4/lib/commons-logging.jar"/>
 	<classpathentry kind="lib" path="tools/buildtime/junit-3.8.1.jar"/>
-	<classpathentry kind="lib" path="tools/buildtime/mockrunner-0.35/lib/nekohtml.jar"/>
-	<classpathentry sourcepath="/Users/dave/Desktop/inbox/mockrunner-0.3.5/src" kind="lib" path="tools/buildtime/mockrunner-0.35/lib/mockrunner-struts.jar"/>
-	<classpathentry sourcepath="/Applications/Java/mockrunner-0.3.5/src" kind="lib" path="tools/buildtime/mockrunner-0.35/lib/mockrunner-servlet.jar"/>
-	<classpathentry sourcepath="/Applications/Java/mockrunner-0.3.5/src" kind="lib" path="tools/buildtime/mockrunner-0.35/lib/mockrunner.jar"/>
-	<classpathentry kind="lib" path="tools/lib/rome-fetcher-0.6.jar"/>
-	<classpathentry kind="lib" path="tools/lib/commons-httpclient-2.0.2.jar"/>
-	<classpathentry sourcepath="/Users/dave/Desktop/lucene-1.4.1/src/java" kind="lib" path="tools/lib/lucene-1.4.3.jar"/>
-	<classpathentry kind="lib" path="tools/lib/xmlrpc-2.0.jar"/>
-	<classpathentry kind="lib" path="sandbox/standalone/lib/catalina.jar"/>
+	<classpathentry kind="lib" path="contrib/lib/JSPWiki.jar"/>
+	<classpathentry kind="lib" path="contrib/lib/jython.jar"/>
+	<classpathentry kind="lib" path="contrib/lib/radeox.jar"/>
+	<classpathentry kind="lib" path="contrib/lib/textile4j-1.20.jar"/>
 	<classpathentry kind="output" path="classes.eclipse"/>
 </classpath>

Modified: incubator/roller/branches/roller_2.0/build.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/build.xml?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/build.xml (original)
+++ incubator/roller/branches/roller_2.0/build.xml Tue Sep  6 14:50:59 2005
@@ -385,10 +385,11 @@
     <mkdir dir="${build.stage_web}/WEB-INF/lib"/>
     <mkdir dir="${build.stage_web}/WEB-INF/tlds"/>
 
-    <!-- Jar up web classes -->
+    <!-- Jar up web classes 
     <jar jarfile="${build.stage_web}/WEB-INF/lib/rollerweb.jar">
         <fileset dir="${build.compile_web}" excludes="**/tomcat/**"/>
     </jar>
+    -->
 
     <!-- Copy web contents to staging, plus README files. -->
     <antcall target="copy-web" />
@@ -397,6 +398,7 @@
     <copy todir="${build.stage_web}/WEB-INF/classes">
         <fileset dir="./metadata/database/hibernate" includes="hibernate.cfg.xml"/>
         <fileset dir="${ro.tools}/lib" includes="oscache.properties"/>
+        <fileset dir="${build.compile_web}" excludes="**/tomcat/**"/>
     </copy>
 
     <!-- Copy WEB-INF contents to staging -->
@@ -490,7 +492,33 @@
       </filterset>
       <mapper type="glob" from="*-raw.sql" to="*.sql" />
     </copy>
+	
+    <!-- DB2 -->
+    <copy toDir="${dbscripts}/db2">
+  	  &custom-dbscripts;
+      <fileset dir="./metadata/database">
+        <include name="*.sql" />
+        <exclude name="droptables.sql" />
+      </fileset>
+      <filterset>
+        <filtersfile file="./metadata/database/db_db2.properties"/>
+      </filterset>
+      <mapper type="glob" from="*-raw.sql" to="*.sql" />
+    </copy>	
 
+    <!-- Apache Derby -->
+    <copy toDir="${dbscripts}/derby">
+  	  &custom-dbscripts;
+      <fileset dir="./metadata/database">
+        <include name="*.sql" />
+        <exclude name="droptables.sql" />
+      </fileset>
+      <filterset>
+        <filtersfile file="./metadata/database/db_derby.properties"/>
+      </filterset>
+      <mapper type="glob" from="*-raw.sql" to="*.sql" />
+    </copy>	
+	
 </target>
 
 <!-- ********************************************************************* -->

Added: incubator/roller/branches/roller_2.0/metadata/database/120-to-200-migration-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/120-to-200-migration-raw.sql?rev=279136&view=auto
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/120-to-200-migration-raw.sql (added)
+++ incubator/roller/branches/roller_2.0/metadata/database/120-to-200-migration-raw.sql Tue Sep  6 14:50:59 2005
@@ -0,0 +1,68 @@
+
+-- User permissions within a website
+-- permission_mask: bitmask 001 limited, 011 author, 100 admin
+-- pending: pending user acceptance of invitation to join website
+create table roller_user_permissions (
+    id              varchar(48) not null primary key,
+    website_id      varchar(48) not null,
+    user_id         varchar(48) not null,
+    permission_mask integer not null, 
+    pending         @BOOLEAN_SQL_TYPE_TRUE@ not null
+);
+
+-- Add new handle field to uniquely identify websites in URLs
+alter table website add column handle varchar(255) @ALTER_TABLE_NOT_NULL@;
+alter table website add column datecreated  timestamp @ALTER_TABLE_NOT_NULL@;
+alter table website add column emailaddress varchar(255) @ALTER_TABLE_NOT_NULL@;
+create index website_handle_index on website(handle);
+alter table website add constraint website_handle_uq unique (handle@INDEXSIZE@);
+
+-- Add userid to weblogentry so we can track original creator of entry
+alter table weblogentry add column userid varchar(48) @ALTER_TABLE_NOT_NULL@;
+alter table weblogentry add column status varchar(20) @ALTER_TABLE_NOT_NULL@;
+create index weblogentry_userid_index on weblogentry(userid);
+
+alter table rolleruser add column isenabled @BOOLEAN_SQL_TYPE_TRUE@ @ALTER_TABLE_NOT_NULL@;
+alter table rolleruser add column locale varchar(50) @ALTER_TABLE_NOT_NULL@;
+alter table rolleruser add column timezone varchar(50) @ALTER_TABLE_NOT_NULL@;
+create index user_isenabled_index on rolleruser( isenabled );
+
+-- -----------------------------------------------------
+
+insert roller_properties (name,value) values ('site.shortName','');
+insert roller_properties (name,value) values ('planet.cache.dir','/var/roller/planet-cache');
+
+-- -----------------------------------------------------
+
+-- Audit log records time and comment about change
+-- user_id: user that made change
+-- object_id: id of associated object, if any
+-- object_class: name of associated object class (e.g. WeblogEntryData)
+-- comment: description of change
+-- change_time: time that change was made
+create table roller_audit_log (
+    id              varchar(48) not null primary key,
+    user_id         varchar(48) not null,  
+    object_id       varchar(48),           
+    object_class    varchar(255),          
+    comment         varchar(255) not null, 
+    change_time     timestamp              
+);
+
+-- -----------------------------------------------------
+-- For ROL-754. MySQL 5.x introduced a new keyword "condition"
+-- which made the use of "condition" as a column name in the "pingtarget" table illegal.
+-- This renames the column to "conditioncode".   There is a corresponding change in the
+-- Hibernate mapping metadata.
+
+-- Create the new column.  If your database will not autopopulate new columns with default values, you may
+-- have to remove the "not null" clause here.
+alter table pingtarget add column conditioncode integer default 0 not null;
+
+-- Transfer old column data to the new column.  This is not critical as currently it is not used, and
+-- later the data will be generated by usage in the ping processor.
+update pingtarget pt set pt.conditioncode=pt.condition;
+
+-- Drop the old column.
+alter table pingtarget drop column condition;
+-- -----------------------------------------------------

Modified: incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql Tue Sep  6 14:50:59 2005
@@ -1,485 +1,500 @@
-
--- Run this script to create the Roller database tables in your database.
--- Make sure you run the correct version of this script.
---
--- * For MySQL run the script createdb.sql found in the mysql directory.
--- * For PostgreSQL run the script createdb.sql found in the postgresql directory.
--- * For HSQLDB run the script createdb.sql found in the hsqldb directory.
--- 
--- For those who grabbed Roller source from CVS, don't try to run the script 
--- named createdb-raw.sql, it is the source from which the above scripts are 
--- created.
-
--- *****************************************************
--- Create the tables and indices
-
-create table rolleruser (
-    id              varchar(48) not null primary key,
-    username        varchar(255) not null,
-    passphrase      varchar(255) not null,
-    fullname        varchar(255) not null,
-    emailaddress    varchar(255) not null,
-    datecreated     timestamp not null,
-    locale          varchar(20) null,  
-    timezone        varchar(50) null,    
-    isenabled       @BOOLEAN_SQL_TYPE_TRUE@ not null
-);
-alter table rolleruser add constraint rolleruser_username_uq unique ( username@INDEXSIZE@ );
-
-create table userrole (
-    id               varchar(48) not null primary key,
-    rolename         varchar(255) not null,
-    username         varchar(255) not null,
-    userid           varchar(48) not null
-);
-create index userrole_userid_index on userrole( userid );
-create index userrole_username_index on userrole( username@INDEXSIZE@ );
-
--- User permissions within a website
-create table roller_user_permissions (
-    id              varchar(48) not null primary key,
-    website_id      varchar(48) not null,
-    user_id         varchar(48) not null,
-    permission_mask integer not null, -- bitmask 001 limited, 011 author, 100 admin
-    pending         @BOOLEAN_SQL_TYPE_TRUE@ not null -- pending user acceptance of invitation to join website
-);
-
--- Audit log records time and comment about change
-create table roller_audit_log (
-    id              varchar(48) not null primary key,
-    user_id         varchar(48) not null,  -- user that made change
-    object_id       varchar(48),           -- id of associated object, if any
-    object_class    varchar(255),          -- name of associated object class (e.g. WeblogEntryData)
-    comment         varchar(255) not null, -- description of change
-    change_time     timestamp              -- time that change was made
-);
-
-create table usercookie (
-    id              varchar(48) not null primary key,
-    username        varchar(255) not null,
-    cookieid        varchar(100) not null,
-    datecreated     timestamp not null
-);
-create index usercookie_username_index on usercookie( username@INDEXSIZE@ );
-create index usercookie_cookieid_index on usercookie( cookieid@INDEXSIZE@ );
-
-create table webpage (
-    id              varchar(48)  not null primary key,
-    name            varchar(255)  not null,
-    description     varchar(255)  null,
-    link            varchar(255)  null,
-    websiteid       varchar(255)  not null,
-    template        @TEXT_SQL_TYPE@ not null,
-    updatetime      timestamp     not null
-);
-create index webpage_name_index on webpage( name@INDEXSIZE@ );
-create index webpage_link_index on webpage( link@INDEXSIZE@ );
-create index webpage_id_index on webpage( websiteid );
-
-create table website (
-    id                varchar(48) not null primary key,
-    name              varchar(255) not null,
-    handle            varchar(255) not null,
-    description       varchar(255) not null,
-    userid            varchar(48) not null,
-    defaultpageid     varchar(48) default 0 not null,
-    weblogdayid       varchar(48) not null,
-    ignorewords       @TEXT_SQL_TYPE@,
-    enablebloggerapi  @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    editorpage        varchar(255) null,
-    bloggercatid      varchar(48) null,
-    defaultcatid      varchar(48) null,
-    allowcomments     @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    emailcomments     @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    emailfromaddress  varchar(255) null,
-    emailaddress      varchar(255) not null,
-    editortheme       varchar(255) null,
-    locale            varchar(20) null, 
-    timezone          varchar(50) null,  
-    defaultplugins    varchar(255) null,
-    pinnedtomain      @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    isenabled         @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    datecreated     timestamp not null
-);
-create index website_id_index        on website(id);
-create index website_userid_index    on website(userid);
-create index website_isenabled_index on website(isenabled);
-create index website_handle_index    on website(handle);
-alter table website add constraint website_handle_uq unique (handle@INDEXSIZE@);
-
-create table folder (
-    id               varchar(48) not null primary key,
-    name             varchar(255) not null,
-    description      varchar(255) null,
-    websiteid        varchar(48) not null,
-    parentid        varchar(48)
-);
-create index folder_websiteid_index on folder( websiteid );
-
-create table folderassoc (
-    id               varchar(48) not null primary key,
-    folderid         varchar(48) not null,
-    ancestorid       varchar(40),
-    relation         varchar(20) not null
-);
-create index folderassoc_folderid_index on folderassoc( folderid );
-create index folderassoc_ancestorid_index on folderassoc( ancestorid );
-create index folderassoc_relation_index on folderassoc( relation );
-
-create table bookmark (
-    id               varchar(48) not null primary key,
-    folderid         varchar(48) not null,
-    name             varchar(255) not null,
-    description      varchar(255) null,
-    url              varchar(255) not null,
-    weight           integer default 0 not null,
-    priority         integer default 100 not null,
-    image            varchar(255) null,
-    feedurl          varchar(255) null
-);
-create index bookmark_folderid_index on bookmark( folderid );
-
-
-create table weblogcategory (
-    id               varchar(48)  not null primary key,
-    name             varchar(255) not null,
-    description      varchar(255) null,
-    websiteid        varchar(48)  not null,
-    image            varchar(255) null
-);
-create index weblogcategory_websiteid_index on weblogcategory( websiteid );
--- alter table weblogcategory add unique category_nameparentid_uq (parentid, name(20));
-
-create table weblogcategoryassoc (
-    id               varchar(48) not null primary key,
-    categoryid       varchar(48) not null,
-    ancestorid       varchar(40),
-    relation         varchar(20) not null
-);
-create index weblogcategoryassoc_categoryid_index on weblogcategoryassoc( categoryid );
-create index weblogcategoryassoc_ancestorid_index on weblogcategoryassoc( ancestorid );
-create index weblogcategoryassoc_relation_index on weblogcategoryassoc( relation );
-
-create table weblogentry (
-    id              varchar(48)  not null primary key,
-    userid          varchar(48) not null,
-    anchor          varchar(255)  not null,
-    title           varchar(255)  not null,
-    text            @TEXT_SQL_TYPE@ not null,
-    pubtime         timestamp     not null,
-    updatetime      timestamp     not null,
-    websiteid       varchar(48)  not null,
-    categoryid      varchar(48)  not null,
-    publishentry    @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    link            varchar(255) null,
-    plugins         varchar(255) null,
-    allowcomments   @BOOLEAN_SQL_TYPE_FALSE@ not null, 
-    commentdays     integer default 7 not null,
-    rightToLeft     @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    pinnedtomain    @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    locale          varchar(20) null,
-    status          varchar(20) not null
-);
-create index weblogentry_websiteid_index on weblogentry( websiteid );
-create index weblogentry_categoryid_index on weblogentry( categoryid );
-create index weblogentry_pubtime_index on weblogentry( pubtime,publishentry,websiteid );
-create index weblogentry_pinnedtomain_index on weblogentry(pinnedtomain);
-create index weblogentry_publishentry_index on weblogentry(publishentry);
-create index weblogentry_userid_index on weblogentry(userid);
-
-create table newsfeed (
-    id              varchar(48) not null primary key,
-    name            varchar(255) not null,
-    description     varchar(255) not null,
-    link            varchar(255) not null,
-    websiteid       varchar(48) not null
-);
-create index newsfeed_websiteid_index on newsfeed( websiteid );
-
-
-create table comment (
-    id      varchar(48) not null primary key,
-    entryid varchar(48) not null,
-    name    varchar(255) null,
-    email   varchar(255) null,
-    url     varchar(255) null,
-    content @TEXT_SQL_TYPE@ null,
-    posttime timestamp   not null,
-    spam    @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    notify  @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    remotehost varchar(128) null
-);
-create index comment_entryid_index on comment( entryid );
-
--- Ping Feature Tables
-
-create table pingtarget (
-    id           varchar(48) not null primary key,
-    name         varchar(255) not null, -- short descriptive name of the ping target
-    pingurl      varchar(255) not null,  -- URL to receive the ping
-    websiteid    varchar(48) null, -- if not null, this is a custom target defined by the associated website
-    conditioncode    integer default 0 not null, -- condition code
-    lastsuccess  timestamp null -- last successful use
-);
-create index pingtarget_websiteid_index on pingtarget( websiteid );
-
--- auto ping configurations
-create table autoping (
-    id            varchar(48) not null primary key,
-    websiteid     varchar(48) not null, -- fk reference to website for which this auto ping configuration applies
-    pingtargetid  varchar(48) not null -- fk reference to the ping target to be pinged when the website changes
-);
-create index autoping_websiteid_index on autoping( websiteid );
-create index autoping_pingtargetid_index on autoping( pingtargetid );
-
-create table pingcategory (
-    id            varchar(48) not null primary key,
-    autopingid  varchar(48) not null, -- fk reference to ping configuration
-    categoryid    varchar(48) not null -- fk reference to category
-);
-create index pingcategory_autopingid_index on pingcategory( autopingid );
-create index pingcategory_categoryid_index on pingcategory( categoryid );
-
-create table pingqueueentry (
-    id             varchar(48) not null primary key,
-    entrytime      timestamp not null, -- timestamp of original entry onto the ping queue
-    pingtargetid   varchar(48) not null,  -- weak fk reference to ping target (not constrained)
-    websiteid      varchar(48) not null,  -- weak fk reference to website originating the ping (not constrained)
-    attempts       integer not null -- number of ping attempts that have been made for this entry
-);
-create index pingqueueentry_entrytime_index on pingqueueentry( entrytime );
-create index pingqueueentry_pingtargetid_index on pingqueueentry( pingtargetid );
-create index pingqueueentry_websiteid_index on pingqueueentry( websiteid );
-
-
--- Referer tracks URLs that refer to websites and entries
-create table referer (
-    id        varchar(48) not null primary key,
-    websiteid varchar(48) not null,
-    entryid   varchar(48),
-    datestr   varchar(10),
-    refurl    varchar(255) not null,
-    refpermalink varchar(255),
-    reftime   timestamp,
-    requrl    varchar(255),
-    title     varchar(255),
-    excerpt   @TEXT_SQL_TYPE@ null,
-    dayhits   integer default 0 not null,
-    totalhits integer default 0 not null,
-    visible   @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    duplicate @BOOLEAN_SQL_TYPE_FALSE@ not null
-);
-create index referer_websiteid_index on referer( websiteid );
-create index referer_entryid_index on referer( entryid );
-create index referer_refurl_index on referer( refurl@INDEXSIZE@ );
-create index referer_requrl_index on referer( requrl@INDEXSIZE@ );
-create index referer_datestr_index on referer( datestr );
-create index referer_refpermalink_index on referer( refpermalink@INDEXSIZE@ );
-create index referer_duplicate_index on referer( duplicate );
-
--- Configuration options for Roller, should only ever be one row
--- Deprecated in 1.2: configuration now stored in roller_properties table
-create table rollerconfig (
-    id              varchar(48) not null primary key,
-    sitedescription varchar(255) null,
-    sitename        varchar(255) null,
-    emailaddress    varchar(255) null,
-    absoluteurl     varchar(255) null,
-    adminusers      varchar(255) null,
-    encryptpasswords @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    algorithm       varchar(10) null,
-    newuserallowed  @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    editorpages     varchar(255) null,
-    userthemes      varchar(255) not null,
-    indexdir        varchar(255) null,
-    memdebug        @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    autoformatcomments @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    escapecommenthtml @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    emailcomments   @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    enableaggregator @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    enablelinkback  @BOOLEAN_SQL_TYPE_FALSE@ not null,
-    rsscachetime    integer default 3000 not null,
-    rssusecache     @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    uploadallow     varchar(255) null,
-    uploadforbid    varchar(255) null,
-    uploadenabled   @BOOLEAN_SQL_TYPE_TRUE@ not null,
-    uploaddir       varchar(255) not null,
-    uploadpath      varchar(255) not null,
-    uploadmaxdirmb  decimal(5,2) default 4.0 not null,
-    uploadmaxfilemb decimal(5,2) default 1.5 not null,
-    dbversion       varchar(10) null,
-    refspamwords    @TEXT_SQL_TYPE@
-);
-
-create table roller_properties (
-    name     varchar(255) not null primary key,
-    value    @TEXT_SQL_TYPE@
-);
-
--- Entry attribute: metadata for weblog entries
-create table entryattribute (
-    id       varchar(48) not null primary key,
-    entryid  varchar(48) not null,
-    name     varchar(255) not null,
-    value    @TEXT_SQL_TYPE@ not null
-);
-create index entryattribute_entryid_index on entryattribute( entryid );
-alter table entryattribute add constraint entryattribute_name_uq unique ( entryid, name@INDEXSIZE@ );
-
-create table rag_group_subscription (
-    id               varchar(48) not null primary key,
-    group_id         varchar(48) not null,
-    subscription_id  varchar(48) not null
-);
-create index rag_group_subscription_gid on rag_group_subscription(group_id@INDEXSIZE@); 
-create index rag_group_subscription_sid on rag_group_subscription(subscription_id@INDEXSIZE@); 
-
-create table rag_config (
-    id               varchar(48) not null primary key,
-    default_group_id varchar(48),
-    title            varchar(255) not null,
-    description      varchar(255),
-    site_url         varchar(255),
-    output_dir       varchar(255),
-    cache_dir        varchar(255) not null,
-    template_dir     varchar(255),
-    main_page        varchar(255),
-    admin_name       varchar(255),
-    admin_email      varchar(255) not null,
-    group_page       varchar(255),
-    proxy_host       varchar(255),
-    proxy_port       integer default -1
-);
-
-create table rag_group (
-    id               varchar(48) not null primary key,
-    handle           varchar(255) not null,
-    title            varchar(255) not null,
-    description      varchar(255),
-    cat_restriction  @TEXT_SQL_TYPE@,
-    group_page       varchar(255),
-    max_page_entries integer default 30,
-    max_feed_entries integer default 30
-);
-alter table rag_group add constraint rag_group_handle_uq unique ( handle@INDEXSIZE@ );
-create index rag_group_handle on rag_group(handle@INDEXSIZE@); 
-
-create table rag_subscription (
-    id               varchar(48) not null primary key,
-    title            varchar(255),
-    feed_url         varchar(255) not null,
-    site_url         varchar(255),
-    author           varchar(255),
-    last_updated     timestamp,
-    inbound_links    integer default -1,
-    inbound_blogs    integer default -1
-);
-alter table rag_subscription add constraint rag_feed_url_uq unique ( feed_url@INDEXSIZE_LARGE@ );
-create index rag_subscription_feed_url on rag_subscription(feed_url@INDEXSIZE@); 
-
-create table rag_entry (
-    id               varchar(48) not null primary key,
-    subscription_id  varchar(48) not null,
-    handle           varchar(255),
-    title            varchar(255),
-    guid             varchar(255),
-    permalink        @TEXT_SQL_TYPE@ not null,
-    author           varchar(255),
-    content          @TEXT_SQL_TYPE@,
-    categories       @TEXT_SQL_TYPE@,
-    published        timestamp not null,
-    updated          timestamp    
-);
-create index rag_entry_sid on rag_entry(subscription_id@INDEXSIZE@); 
-
--- *****************************************************
--- Now add the foreign key relationships
-
--- user, role and website
-
-alter table website add constraint website_userid_fk
-    foreign key ( userid ) references rolleruser ( id );
-
-alter table userrole add constraint userrole_userid_fk
-    foreign key ( userid ) references rolleruser( id );
-
--- page, entry, category, comment
-
-alter table webpage add constraint weblogpage_websiteid_fk
-    foreign key ( websiteid ) references website( id );
-
-alter table weblogentry add constraint weblogentry_websiteid_fk
-    foreign key ( websiteid ) references website( id );
-
-alter table weblogentry add constraint weblogentry_categoryid_fk
-    foreign key ( categoryid ) references weblogcategory( id );
-
-alter table weblogcategory add constraint weblogcategory_websiteid_fk
-    foreign key ( websiteid ) references website( id );
-
-alter table comment add constraint comment_entryid_fk
-    foreign key ( entryid ) references weblogentry( id );
-
-alter table entryattribute add constraint att_entryid_fk
-    foreign key ( entryid ) references weblogentry( id );
-
--- referer
-
-alter table referer add constraint referer_entryid_fk
-    foreign key ( entryid ) references weblogentry( id );
-
-alter table referer add constraint referer_websiteid_fk
-    foreign key ( websiteid ) references website( id );
-
--- folder and bookmark
-
-alter table folder add constraint folder_websiteid_fk
-    foreign key ( websiteid ) references website( id );
-
--- alter table folder add constraint folder_parentid_fk
---     foreign key ( parentid ) references folder( id );
-
-alter table bookmark add constraint bookmark_folderid_fk
-    foreign key ( folderid ) references folder( id );
-
--- newsfeed
-
-alter table newsfeed add constraint newsfeed_websiteid_fk
-    foreign key ( websiteid ) references website( id );
-
--- pingtarget, autoping, pingcategory
-
-alter table pingtarget add constraint pingtarget_websiteid_fk
-    foreign key (websiteid) references website(id);
-
-alter table autoping add constraint autoping_websiteid_fk
-    foreign key (websiteid) references website(id);
-
-alter table autoping add constraint autoping_pingtargetid_fk
-    foreign key (pingtargetid) references pingtarget(id);
-
-alter table pingcategory add constraint pingcategory_autopingid_fk
-    foreign key (autopingid) references autoping(id);
-
-alter table pingcategory add constraint pingcategory_categoryid_fk
-    foreign key (categoryid) references weblogcategory(id);
-
-
--- THE FOLLOWING CONSTRAINTS CAN NOT BE SUPPORTED FOR IMPORTING new-user.xml
--- alter table website add constraint website_defaultpageid_fk foreign key ( defaultpageid ) references webpage ( id );
--- alter table website add constraint website_weblogdayid_fk foreign key ( weblogdayid ) references webpage ( id );
--- alter table webpage add constraint webpage_websiteid_fk foreign key ( websiteid ) references website( id );
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+-- Run this script to create the Roller database tables in your database.
+-- Make sure you run the correct version of this script.
+--
+-- * For MySQL run the script createdb.sql found in the mysql directory.
+-- * For PostgreSQL run the script createdb.sql found in the postgresql directory.
+-- * For HSQLDB run the script createdb.sql found in the hsqldb directory.
+-- 
+-- For those who grabbed Roller source from CVS, don't try to run the script 
+-- named createdb-raw.sql, it is the source from which the above scripts are 
+-- created.
+
+-- *****************************************************
+-- Create the tables and indices
+
+create table rolleruser (
+    id              varchar(48) not null primary key,
+    username        varchar(255) not null,
+    passphrase      varchar(255) not null,
+    fullname        varchar(255) not null,
+    emailaddress    varchar(255) not null,
+    datecreated     timestamp not null,
+    locale          varchar(20),  
+    timezone        varchar(50),    
+    isenabled       @BOOLEAN_SQL_TYPE_TRUE@ not null
+);
+alter table rolleruser add constraint rolleruser_username_uq unique ( username@INDEXSIZE@ );
+
+create table userrole (
+    id               varchar(48) not null primary key,
+    rolename         varchar(255) not null,
+    username         varchar(255) not null,
+    userid           varchar(48) not null
+);
+create index userrole_userid_index on userrole( userid );
+create index userrole_username_index on userrole( username@INDEXSIZE@ );
+
+-- User permissions within a website
+-- permission_mask: bitmask 001 limited, 011 author, 100 admin
+-- pending: pending user acceptance of invitation to join website
+create table roller_user_permissions (
+    id              varchar(48) not null primary key,
+    website_id      varchar(48) not null,
+    user_id         varchar(48) not null,
+    permission_mask integer not null, 
+    pending         @BOOLEAN_SQL_TYPE_TRUE@ not null
+);
+
+-- Audit log records time and comment about change
+-- user_id: user that made change
+-- object_id: id of associated object, if any
+-- object_class: name of associated object class (e.g. WeblogEntryData)
+-- comment: description of change
+-- change_time: time that change was made
+create table roller_audit_log (
+    id              varchar(48) not null primary key,
+    user_id         varchar(48) not null,  
+    object_id       varchar(48),           
+    object_class    varchar(255),          
+    comment         varchar(255) not null, 
+    change_time     timestamp              
+);
+
+create table usercookie (
+    id              varchar(48) not null primary key,
+    username        varchar(255) not null,
+    cookieid        varchar(100) not null,
+    datecreated     timestamp not null
+);
+create index usercookie_username_index on usercookie( username@INDEXSIZE@ );
+create index usercookie_cookieid_index on usercookie( cookieid@INDEXSIZE@ );
+
+create table webpage (
+    id              varchar(48)  not null primary key,
+    name            varchar(255)  not null,
+    description     varchar(255),
+    link            varchar(255),
+    websiteid       varchar(48)  not null,
+    template        @TEXT_SQL_TYPE@ not null,
+    updatetime      timestamp     not null
+);
+create index webpage_name_index on webpage( name@INDEXSIZE@ );
+create index webpage_link_index on webpage( link@INDEXSIZE@ );
+create index webpage_id_index on webpage( websiteid );
+
+create table website (
+    id                varchar(48) not null primary key,
+    name              varchar(255) not null,
+    handle            varchar(255) not null,
+    description       varchar(255) not null,
+    userid            varchar(48) not null,
+    defaultpageid     varchar(48) default '' not null,
+    weblogdayid       varchar(48) not null,
+    ignorewords       @TEXT_SQL_TYPE@,
+    enablebloggerapi  @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    editorpage        varchar(255),
+    bloggercatid      varchar(48),
+    defaultcatid      varchar(48),
+    allowcomments     @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    emailcomments     @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    emailfromaddress  varchar(255),
+    emailaddress      varchar(255) not null,
+    editortheme       varchar(255),
+    locale            varchar(20), 
+    timezone          varchar(50),  
+    defaultplugins    varchar(255),
+    pinnedtomain      @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    isenabled         @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    datecreated     timestamp not null
+);
+create index website_userid_index    on website(userid);
+create index website_isenabled_index on website(isenabled);
+create index website_handle_index    on website(handle);
+alter table website add constraint website_handle_uq unique (handle@INDEXSIZE@);
+
+create table folder (
+    id               varchar(48) not null primary key,
+    name             varchar(255) not null,
+    description      varchar(255),
+    websiteid        varchar(48) not null,
+    parentid        varchar(48)
+);
+create index folder_websiteid_index on folder( websiteid );
+
+create table folderassoc (
+    id               varchar(48) not null primary key,
+    folderid         varchar(48) not null,
+    ancestorid       varchar(40),
+    relation         varchar(20) not null
+);
+create index folderassoc_folderid_index on folderassoc( folderid );
+create index folderassoc_ancestorid_index on folderassoc( ancestorid );
+create index folderassoc_relation_index on folderassoc( relation );
+
+create table bookmark (
+    id               varchar(48) not null primary key,
+    folderid         varchar(48) not null,
+    name             varchar(255) not null,
+    description      varchar(255),
+    url              varchar(255) not null,
+    weight           integer default 0 not null,
+    priority         integer default 100 not null,
+    image            varchar(255),
+    feedurl          varchar(255)
+);
+create index bookmark_folderid_index on bookmark( folderid );
+
+create table weblogcategory (
+    id               varchar(48)  not null primary key,
+    name             varchar(255) not null,
+    description      varchar(255),
+    websiteid        varchar(48)  not null,
+    image            varchar(255)
+);
+create index weblogcategory_websiteid_index on weblogcategory( websiteid );
+-- alter table weblogcategory add unique category_nameparentid_uq (parentid, name(20));
+
+create table weblogcategoryassoc (
+    id               varchar(48) not null primary key,
+    categoryid       varchar(48) not null,
+    ancestorid       varchar(40),
+    relation         varchar(20) not null
+);
+create index weblogcategoryassoc_categoryid_index on weblogcategoryassoc( categoryid );
+create index weblogcategoryassoc_ancestorid_index on weblogcategoryassoc( ancestorid );
+create index weblogcategoryassoc_relation_index on weblogcategoryassoc( relation );
+
+create table weblogentry (
+    id              varchar(48)  not null primary key,
+    userid          varchar(48) not null,
+    anchor          varchar(255)  not null,
+    title           varchar(255)  not null,
+    text            @TEXT_SQL_TYPE@ not null,
+    pubtime         timestamp     not null,
+    updatetime      timestamp     not null,
+    websiteid       varchar(48)  not null,
+    categoryid      varchar(48)  not null,
+    publishentry    @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    link            varchar(255),
+    plugins         varchar(255),
+    allowcomments   @BOOLEAN_SQL_TYPE_FALSE@ not null, 
+    commentdays     integer default 7 not null,
+    rightToLeft     @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    pinnedtomain    @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    locale          varchar(20),
+    status          varchar(20) not null
+);
+create index weblogentry_websiteid_index on weblogentry( websiteid );
+create index weblogentry_categoryid_index on weblogentry( categoryid );
+create index weblogentry_pubtime_index on weblogentry( pubtime,publishentry,websiteid );
+create index weblogentry_pinnedtomain_index on weblogentry(pinnedtomain);
+create index weblogentry_publishentry_index on weblogentry(publishentry);
+create index weblogentry_userid_index on weblogentry(userid);
+
+create table newsfeed (
+    id              varchar(48) not null primary key,
+    name            varchar(255) not null,
+    description     varchar(255) not null,
+    link            varchar(255) not null,
+    websiteid       varchar(48) not null
+);
+create index newsfeed_websiteid_index on newsfeed( websiteid );
+
+
+create table comment (
+    id      varchar(48) not null primary key,
+    entryid varchar(48) not null,
+    name    varchar(255),
+    email   varchar(255),
+    url     varchar(255),
+    content @TEXT_SQL_TYPE@,
+    posttime timestamp   not null,
+    spam    @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    notify  @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    remotehost varchar(128)
+);
+create index comment_entryid_index on comment( entryid );
+
+-- Ping Feature Tables
+-- name: short descriptive name of the ping target
+-- pingurl: URL to receive the ping
+-- websiteid:  if not null, this is a custom target defined by the associated website
+-- conditioncode:
+-- lastsuccess:
+create table pingtarget (
+    id           varchar(48) not null primary key,
+    name         varchar(255) not null,
+    pingurl      varchar(255) not null,
+    websiteid    varchar(48),
+    conditioncode    integer default 0 not null,
+    lastsuccess  timestamp
+);
+create index pingtarget_websiteid_index on pingtarget( websiteid );
+
+-- auto ping configurations
+-- websiteid:  fk reference to website for which this auto ping configuration applies
+-- pingtargetid: fk reference to the ping target to be pinged when the website changes
+create table autoping (
+    id            varchar(48) not null primary key,
+    websiteid     varchar(48) not null,
+    pingtargetid  varchar(48) not null 
+);
+create index autoping_websiteid_index on autoping( websiteid );
+create index autoping_pingtargetid_index on autoping( pingtargetid );
+
+-- autopingid: fk reference to ping configuration
+-- categoryid: fk reference to category
+create table pingcategory (
+    id            varchar(48) not null primary key,
+    autopingid  varchar(48) not null, 
+    categoryid    varchar(48) not null 
+);
+create index pingcategory_autopingid_index on pingcategory( autopingid );
+create index pingcategory_categoryid_index on pingcategory( categoryid );
+
+-- entrytime: timestamp of original entry onto the ping queue
+-- pingtargetid: weak fk reference to ping target (not constrained)
+-- websiteid: weak fk reference to website originating the ping (not constrained)
+-- attempts:  number of ping attempts that have been made for this entry
+create table pingqueueentry (
+    id             varchar(48) not null primary key,
+    entrytime      timestamp not null, 
+    pingtargetid   varchar(48) not null,  
+    websiteid      varchar(48) not null,  
+    attempts       integer not null
+);
+create index pingqueueentry_entrytime_index on pingqueueentry( entrytime );
+create index pingqueueentry_pingtargetid_index on pingqueueentry( pingtargetid );
+create index pingqueueentry_websiteid_index on pingqueueentry( websiteid );
+
+
+-- Referer tracks URLs that refer to websites and entries
+create table referer (
+    id        varchar(48) not null primary key,
+    websiteid varchar(48) not null,
+    entryid   varchar(48),
+    datestr   varchar(10),
+    refurl    varchar(255) not null,
+    refpermalink varchar(255),
+    reftime   timestamp,
+    requrl    varchar(255),
+    title     varchar(255),
+    excerpt   @TEXT_SQL_TYPE@,
+    dayhits   integer default 0 not null,
+    totalhits integer default 0 not null,
+    visible   @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    duplicate @BOOLEAN_SQL_TYPE_FALSE@ not null
+);
+create index referer_websiteid_index on referer( websiteid );
+create index referer_entryid_index on referer( entryid );
+create index referer_refurl_index on referer( refurl@INDEXSIZE@ );
+create index referer_requrl_index on referer( requrl@INDEXSIZE@ );
+create index referer_datestr_index on referer( datestr );
+create index referer_refpermalink_index on referer( refpermalink@INDEXSIZE@ );
+create index referer_duplicate_index on referer( duplicate );
+
+-- Configuration options for Roller, should only ever be one row
+-- Deprecated in 1.2: configuration now stored in roller_properties table
+create table rollerconfig (
+    id              varchar(48) not null primary key,
+    sitedescription varchar(255),
+    sitename        varchar(255),
+    emailaddress    varchar(255),
+    absoluteurl     varchar(255),
+    adminusers      varchar(255),
+    encryptpasswords @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    algorithm       varchar(10),
+    newuserallowed  @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    editorpages     varchar(255),
+    userthemes      varchar(255) not null,
+    indexdir        varchar(255),
+    memdebug        @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    autoformatcomments @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    escapecommenthtml @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    emailcomments   @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    enableaggregator @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    enablelinkback  @BOOLEAN_SQL_TYPE_FALSE@ not null,
+    rsscachetime    integer default 3000 not null,
+    rssusecache     @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    uploadallow     varchar(255),
+    uploadforbid    varchar(255),
+    uploadenabled   @BOOLEAN_SQL_TYPE_TRUE@ not null,
+    uploaddir       varchar(255) not null,
+    uploadpath      varchar(255) not null,
+    uploadmaxdirmb  decimal(5,2) default 4.0 not null,
+    uploadmaxfilemb decimal(5,2) default 1.5 not null,
+    dbversion       varchar(10),
+    refspamwords    @TEXT_SQL_TYPE@
+);
+
+create table roller_properties (
+    name     varchar(255) not null primary key,
+    value    @TEXT_SQL_TYPE@
+);
+
+-- Entry attribute: metadata for weblog entries
+create table entryattribute (
+    id       varchar(48) not null primary key,
+    entryid  varchar(48) not null,
+    name     varchar(255) not null,
+    value    @TEXT_SQL_TYPE@ not null
+);
+create index entryattribute_entryid_index on entryattribute( entryid );
+alter table entryattribute add constraint entryattribute_name_uq unique ( entryid, name@INDEXSIZE@ );
+
+create table rag_group_subscription (
+    id               varchar(48) not null primary key,
+    group_id         varchar(48) not null,
+    subscription_id  varchar(48) not null
+);
+create index rag_group_subscription_gid on rag_group_subscription(group_id@INDEXSIZE@); 
+create index rag_group_subscription_sid on rag_group_subscription(subscription_id@INDEXSIZE@); 
+
+create table rag_config (
+    id               varchar(48) not null primary key,
+    default_group_id varchar(48),
+    title            varchar(255) not null,
+    description      varchar(255),
+    site_url         varchar(255),
+    output_dir       varchar(255),
+    cache_dir        varchar(255) not null,
+    template_dir     varchar(255),
+    main_page        varchar(255),
+    admin_name       varchar(255),
+    admin_email      varchar(255) not null,
+    group_page       varchar(255),
+    proxy_host       varchar(255),
+    proxy_port       integer default -1
+);
+
+create table rag_group (
+    id               varchar(48) not null primary key,
+    handle           varchar(255) not null,
+    title            varchar(255) not null,
+    description      varchar(255),
+    cat_restriction  @TEXT_SQL_TYPE@,
+    group_page       varchar(255),
+    max_page_entries integer default 30,
+    max_feed_entries integer default 30
+);
+alter table rag_group add constraint rag_group_handle_uq unique ( handle@INDEXSIZE@ );
+
+create table rag_subscription (
+    id               varchar(48) not null primary key,
+    title            varchar(255),
+    feed_url         varchar(255) not null,
+    site_url         varchar(255),
+    author           varchar(255),
+    last_updated     timestamp,
+    inbound_links    integer default -1,
+    inbound_blogs    integer default -1
+);
+alter table rag_subscription add constraint rag_feed_url_uq unique ( feed_url@INDEXSIZE_LARGE@ );
+
+create table rag_entry (
+    id               varchar(48) not null primary key,
+    subscription_id  varchar(48) not null,
+    handle           varchar(255),
+    title            varchar(255),
+    guid             varchar(255),
+    permalink        @TEXT_SQL_TYPE@ not null,
+    author           varchar(255),
+    content          @TEXT_SQL_TYPE@,
+    categories       @TEXT_SQL_TYPE@,
+    published        timestamp not null,
+    updated          timestamp    
+);
+create index rag_entry_sid on rag_entry(subscription_id@INDEXSIZE@); 
+
+-- *****************************************************
+-- Now add the foreign key relationships
+
+-- user, role and website
+
+alter table website add constraint website_userid_fk
+    foreign key ( userid ) references rolleruser ( id ) @ADDL_FK_PARAMS@ ;
+
+alter table userrole add constraint userrole_userid_fk
+    foreign key ( userid ) references rolleruser( id ) @ADDL_FK_PARAMS@ ;
+
+-- page, entry, category, comment
+
+alter table webpage add constraint weblogpage_websiteid_fk
+    foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
+
+alter table weblogentry add constraint weblogentry_websiteid_fk
+    foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
+
+alter table weblogentry add constraint weblogentry_categoryid_fk
+    foreign key ( categoryid ) references weblogcategory( id ) @ADDL_FK_PARAMS@ ;
+
+alter table weblogcategory add constraint weblogcategory_websiteid_fk
+    foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
+
+alter table comment add constraint comment_entryid_fk
+    foreign key ( entryid ) references weblogentry( id ) @ADDL_FK_PARAMS@ ;
+
+alter table entryattribute add constraint att_entryid_fk
+    foreign key ( entryid ) references weblogentry( id ) @ADDL_FK_PARAMS@ ;
+
+-- referer
+
+alter table referer add constraint referer_entryid_fk
+    foreign key ( entryid ) references weblogentry( id ) @ADDL_FK_PARAMS@ ;
+
+alter table referer add constraint referer_websiteid_fk
+    foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
+
+-- folder and bookmark
+
+alter table folder add constraint folder_websiteid_fk
+    foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
+
+-- alter table folder add constraint folder_parentid_fk
+--     foreign key ( parentid ) references folder( id );
+
+alter table bookmark add constraint bookmark_folderid_fk
+    foreign key ( folderid ) references folder( id ) @ADDL_FK_PARAMS@ ;
+
+-- newsfeed
+
+alter table newsfeed add constraint newsfeed_websiteid_fk
+    foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
+
+-- pingtarget, autoping, pingcategory
+
+alter table pingtarget add constraint pingtarget_websiteid_fk
+    foreign key (websiteid) references website(id) @ADDL_FK_PARAMS@ ;
+
+alter table autoping add constraint autoping_websiteid_fk
+    foreign key (websiteid) references website(id) @ADDL_FK_PARAMS@ ;
+
+alter table autoping add constraint autoping_pingtargetid_fk
+    foreign key (pingtargetid) references pingtarget(id) @ADDL_FK_PARAMS@ ;
+
+alter table pingcategory add constraint pingcategory_autopingid_fk
+    foreign key (autopingid) references autoping(id) @ADDL_FK_PARAMS@ ;
+
+alter table pingcategory add constraint pingcategory_categoryid_fk
+    foreign key (categoryid) references weblogcategory(id) @ADDL_FK_PARAMS@ ;
+
+
+-- THE FOLLOWING CONSTRAINTS CAN NOT BE SUPPORTED FOR IMPORTING new-user.xml
+-- alter table website add constraint website_defaultpageid_fk foreign key ( defaultpageid ) references webpage ( id );
+-- alter table website add constraint website_weblogdayid_fk foreign key ( weblogdayid ) references webpage ( id );
+-- alter table webpage add constraint webpage_websiteid_fk foreign key ( websiteid ) references website( id );
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: incubator/roller/branches/roller_2.0/metadata/database/db_db2.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/db_db2.properties?rev=279136&view=auto
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/db_db2.properties (added)
+++ incubator/roller/branches/roller_2.0/metadata/database/db_db2.properties Tue Sep  6 14:50:59 2005
@@ -0,0 +1 @@
+TEXT_SQL_TYPE=clob(102400)
BOOLEAN_SQL_TYPE_FALSE=smallint default 0
BOOLEAN_SQL_TYPE_TRUE=smallint default 1
BOOLEAN_SQL_TYPE=smallint
BOOLEAN_FALSE=0
BOOLEAN_TRUE=1
INDEXSIZE=
INDEXSIZE_LARGE=
ALTER_TABLE_NOT_NULL= not null
ADDL_FK_PARAMS=on delete no action on update no action enforced enable query optimization
\ No newline at end of file

Added: incubator/roller/branches/roller_2.0/metadata/database/db_derby.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/db_derby.properties?rev=279136&view=auto
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/db_derby.properties (added)
+++ incubator/roller/branches/roller_2.0/metadata/database/db_derby.properties Tue Sep  6 14:50:59 2005
@@ -0,0 +1 @@
+TEXT_SQL_TYPE=clob(102400)
BOOLEAN_SQL_TYPE_FALSE=smallint default 0
BOOLEAN_SQL_TYPE_TRUE=smallint default 1
BOOLEAN_SQL_TYPE=smallint
BOOLEAN_FALSE=0
BOOLEAN_TRUE=1
INDEXSIZE=
INDEXSIZE_LARGE=
ALTER_TABLE_NOT_NULL= not null
ADDL_FK_PARAMS=
\ No newline at end of file

Modified: incubator/roller/branches/roller_2.0/metadata/database/db_hsql.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/db_hsql.properties?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/db_hsql.properties (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/db_hsql.properties Tue Sep  6 14:50:59 2005
@@ -7,3 +7,4 @@
 INDEXSIZE= 
 INDEXSIZE_LARGE=
 ALTER_TABLE_NOT_NULL= not null
+ADDL_FK_PARAMS=

Modified: incubator/roller/branches/roller_2.0/metadata/database/db_mysql.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/db_mysql.properties?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/db_mysql.properties (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/db_mysql.properties Tue Sep  6 14:50:59 2005
@@ -1 +1 @@
-TEXT_SQL_TYPE=text
BOOLEAN_SQL_TYPE_FALSE=bit default 0
BOOLEAN_SQL_TYPE_TRUE=bit default 1
BOOLEAN_SQL_TYPE=bit
BOOLEAN_FALSE=0
BOOLEAN_TRUE=1
INDEXSIZE=(40)
INDEXSIZE_LARGE=(100)
ALTER_TABLE_NOT_NULL= not null
\ No newline at end of file
+TEXT_SQL_TYPE=text
BOOLEAN_SQL_TYPE_FALSE=bit default 0
BOOLEAN_SQL_TYPE_TRUE=bit default 1
BOOLEAN_SQL_TYPE=bit
BOOLEAN_FALSE=0
BOOLEAN_TRUE=1
INDEXSIZE=(40)
INDEXSIZE_LARGE=(100)
ALTER_TABLE_NOT_NULL= not null
ADDL_FK_PARAMS=
\ No newline at end of file

Modified: incubator/roller/branches/roller_2.0/metadata/database/db_postgresql.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/db_postgresql.properties?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/db_postgresql.properties (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/db_postgresql.properties Tue Sep  6 14:50:59 2005
@@ -6,4 +6,5 @@
 BOOLEAN_TRUE=true
 INDEXSIZE=
 INDEXSIZE_LARGE=
-ALTER_TABLE_NOT_NULL=
\ No newline at end of file
+ALTER_TABLE_NOT_NULL=
+ADDL_FK_PARAMS=
\ No newline at end of file

Modified: incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml Tue Sep  6 14:50:59 2005
@@ -10,9 +10,11 @@
         <property name="connection.datasource">java:comp/env/jdbc/rollerdb</property>
         <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
         <!--
-        If you want to use HSQLDB or PostgreSQL, then use the right dialect   
+        If you want to use HSQLDB, PostgreSQL, DB2 or Derby, then use the right dialect   
         <property name="dialect">net.sf.hibernate.dialect.HQLDBDialect</property> 
         <property name="dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>
+        <property name="dialect">net.sf.hibernate.dialect.DB2SQLDialect</property>
+        <property name="dialect">net.sf.hibernate.dialect.DerbyDialect</property>
         -->
 
         <!--

Modified: incubator/roller/branches/roller_2.0/metadata/database/rollerdb.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/rollerdb.properties?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/rollerdb.properties (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/rollerdb.properties Tue Sep  6 14:50:59 2005
@@ -16,6 +16,13 @@
 #driverClassName=org.hsqldb.jdbcDriver
 #connectionUrl=jdbc:hsqldb:hsql://localhost:8802
 
+# Exmaple config for DB2
+#userName=db2admin
+#password=db2admin
+#driverClassName=COM.ibm.db2.jdbc.net.DB2Driver
+#connectionUrl=jdbc:db2://localhost/rollerdb
+
+
 # The "src." prefix is for the source database in SyncUpgrade098Xto1000.java
 #src.driverClassName=com.mysql.jdbc.Driver
 #src.ConnectionUrl=jdbc:mysql://localhost/roller_db_10?autoReconnect=true&user=scott&password=tiger&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8

Modified: incubator/roller/branches/roller_2.0/properties.xmlf
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/properties.xmlf?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/properties.xmlf (original)
+++ incubator/roller/branches/roller_2.0/properties.xmlf Tue Sep  6 14:50:59 2005
@@ -52,6 +52,8 @@
     <include name="velocity-1.4.jar"/>
     <include name="velocity-dep-1.4.jar"/>
     <include name="velocity-tools-1.1.jar"/>
+    <include name="mail.jar"/>
+    <include name="activation.jar"/>        
 </fileset>
 
 <fileset id="presentation.jars" dir="${ro.tools}/lib">

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/utils/UpgradeDatabase.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/utils/UpgradeDatabase.java?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/utils/UpgradeDatabase.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/utils/UpgradeDatabase.java Tue Sep  6 14:50:59 2005
@@ -9,6 +9,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import org.roller.pojos.PermissionsData;
 
 
 /**
@@ -98,10 +99,18 @@
         mLogger.info("Database is old, beginning upgrade to version "+myVersion);
         
         // iterate through each upgrade as needed
-        // to add to the upgrade sequence simply add a new "else if" statement
+        // to add to the upgrade sequence simply add a new "if" statement
         // for whatever version needed and then define a new method upgradeXXX()
-        if(dbversion < 130)
+        if(dbversion < 130) 
+        {
             UpgradeDatabase.upgradeTo130(con);
+            dbversion = 130;
+        }
+        if (dbversion < 200)
+        {
+            UpgradeDatabase.upgradeTo200(con);
+            dbversion = 200;
+        }
         
         // make sure the database version is the exact version
         // we are upgrading too.
@@ -136,7 +145,10 @@
             setCustomThemeStmt.setString(1, org.roller.pojos.Theme.CUSTOM);
             setCustomThemeStmt.executeUpdate();
             
+            if (!con.getAutoCommit()) con.commit();
+            
             mLogger.info("Upgrade to 130 complete.");
+            
         } catch (SQLException e) {
             mLogger.error("Problem upgrading database to version 130", e);
             throw new RollerException("Problem upgrading database to version 130", e);
@@ -145,6 +157,78 @@
         // If someone is upgrading to 1.3.x then we are setting the db version
         // for the first time.  Normally we would just updateDatabaseVersion()
         UpgradeDatabase.setDatabaseVersion(con, 130);
+    }
+
+    /**
+     * Upgrade database for Roller 2.0.0
+     */
+    private static void upgradeTo200(Connection con) throws RollerException {
+        try {
+            mLogger.info("Doing upgrade to 200 ...");
+            mLogger.info("Populating roller_user_permissions table");
+            
+            PreparedStatement websitesQuery = con.prepareStatement(
+                "select w.id, u.id, u.username from "
+              + "website as w, rolleruser as u where u.id=w.userid");
+            PreparedStatement websiteUpdate = con.prepareStatement(
+                "update website set handle=? where id=?");         
+            PreparedStatement entryUpdate = con.prepareStatement(
+                "update weblogentry set userid=?, status=?, "
+              + "pubtime=pubtime, updatetime=updatetime "
+              + "where publishentry=?");            
+            PreparedStatement permsInsert = con.prepareStatement(
+                "insert roller_user_permissions "
+              + "(id, website_id, user_id, permission_mask, pending) "
+              + "values (?,?,?,?,?)");
+             
+            // loop through websites, each has a user
+            ResultSet websiteSet = websitesQuery.executeQuery();
+            while (websiteSet.next()) {
+                String websiteid = websiteSet.getString("w.id");
+                String userid = websiteSet.getString("u.id");
+                String handle = websiteSet.getString("u.username");
+                mLogger.info("Processing website: " + handle);
+                       
+                // use website user's username as website handle
+                websiteUpdate.clearParameters();
+                websiteUpdate.setString(1, handle);
+                websiteUpdate.setString(2, websiteid);
+                websiteUpdate.executeUpdate();
+                
+                // update all of pubished entries to include userid and status
+                entryUpdate.clearParameters();
+                entryUpdate.setString( 1, userid);
+                entryUpdate.setString( 2, "PUBLISHED");
+                entryUpdate.setBoolean(3, true);
+                entryUpdate.executeUpdate();                               
+                
+                // update all of draft entries to include userid and status
+                entryUpdate.clearParameters();
+                entryUpdate.setString( 1, userid);
+                entryUpdate.setString( 2, "DRAFT");
+                entryUpdate.setBoolean(3, false);
+                entryUpdate.executeUpdate();                               
+                
+                // add  permission for user in website
+                permsInsert.clearParameters();
+                permsInsert.setString( 1, websiteid+"p");
+                permsInsert.setString( 2, websiteid);
+                permsInsert.setString( 3, userid);
+                permsInsert.setShort(  4, PermissionsData.ADMIN);
+                permsInsert.setBoolean(5, false);
+                permsInsert.executeUpdate();
+            }
+            
+            if (!con.getAutoCommit()) con.commit();
+            
+            mLogger.info("Upgrade to 200 complete.");
+            
+        } catch (SQLException e) {
+            mLogger.error("Problem upgrading database to version 200", e);
+            throw new RollerException("Problem upgrading database to version 200", e);
+        }
+        
+        UpgradeDatabase.updateDatabaseVersion(con, 200);
     }
 
 

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java Tue Sep  6 14:50:59 2005
@@ -105,11 +105,6 @@
         return bundle.getString("weblogEdit.title.editEntry");
     }
 
-    public String getBaseURL()
-    {
-		return getRequest().getContextPath();
-	}
-
     /**
      * Get recent weblog entries using request parameters to determine
      * username, date, and category name parameters.

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserBaseAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserBaseAction.java?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserBaseAction.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserBaseAction.java Tue Sep  6 14:50:59 2005
@@ -1,37 +1,15 @@
 
 package org.roller.presentation.website.actions;
 
-import java.util.Collection;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
+import org.apache.commons.lang.CharSetUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.action.ActionError;
 import org.apache.struts.action.ActionErrors;
 import org.apache.struts.action.ActionMessages;
 import org.apache.struts.actions.DispatchAction;
-import org.roller.RollerException;
-import org.roller.model.RollerFactory;
-import org.roller.model.UserManager;
-import org.roller.pojos.UserData;
-import org.roller.pojos.WebsiteData;
-import org.roller.presentation.RollerContext;
-import org.roller.presentation.RollerRequest;
+import org.roller.config.RollerConfig;
 import org.roller.presentation.website.formbeans.UserFormEx;
-import org.roller.util.DateUtil;
-import org.roller.util.Utilities;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
-import java.util.TreeSet;
-
-import org.roller.model.RollerFactory;
 
 
 /////////////////////////////////////////////////////////////////////////////
@@ -42,12 +20,20 @@
 {
     private static Log mLogger =
         LogFactory.getFactory().getInstance(UserBaseAction.class);
+    
+    protected static String DEFAULT_ALLOWED_CHARS = "A-Za-z0-9";    
 
     //------------------------------------------------------------------------
     /** Validate user form. TODO: replace with Struts validation. */
     protected ActionMessages validate( UserFormEx form, ActionMessages errors ) {
 
-        String safe = Utilities.replaceNonAlphanumeric(form.getUserName());
+    	String allowed = RollerConfig.getProperty("username.allowedChars");
+    	if(allowed == null || allowed.trim().length() == 0) {
+    	       allowed = DEFAULT_ALLOWED_CHARS;
+    	}
+
+    	String safe = CharSetUtils.keep(form.getUserName(), allowed);
+    	
         if ( "".equals(form.getUserName().trim()))
         {
             errors.add( ActionErrors.GLOBAL_ERROR,

Modified: incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java?rev=279136&r1=279135&r2=279136&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/util/Utilities.java Tue Sep  6 14:50:59 2005
@@ -974,6 +974,7 @@
      */
     public static final String textToHTML(String text, boolean xml)
     {
+        if (text == null) return null;
         final StringBuffer html = new StringBuffer();
 
         // Loop thru each characters of the text



Mime
View raw message