You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/02/16 23:40:47 UTC

svn commit: r508630 - in /incubator/roller/trunk: ./ apps/planet/ apps/planet/src/sql/ metadata/database/ metadata/database/tmpls/

Author: agilliland
Date: Fri Feb 16 14:40:45 2007
New Revision: 508630

URL: http://svn.apache.org/viewvc?view=rev&rev=508630
Log:
fixing up Roller dbscript generation process to allow for independent db script generation for Planet and Weblogger apps.  Each application can now maintain and generate it's own db scripts indpendently of the other app.

NOTE: this doesn't solve the issue of how to properly include the planet scripts with the weblogger scripts, that will be tackled in a subsequent commit.


Added:
    incubator/roller/trunk/apps/planet/src/sql/
    incubator/roller/trunk/apps/planet/src/sql/control.vm
    incubator/roller/trunk/apps/planet/src/sql/createdb.vm
    incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties
    incubator/roller/trunk/apps/planet/src/sql/droptables.sql
    incubator/roller/trunk/metadata/database/dbscripts.properties
    incubator/roller/trunk/metadata/database/macros.vm
    incubator/roller/trunk/metadata/database/tmpls/
    incubator/roller/trunk/metadata/database/tmpls/200-to-210-migration.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/200-to-210-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/210-to-230-migration.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/210-to-230-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/230-to-240-migration.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/230-to-240-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/240-to-300-migration.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/240-to-300-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/300-to-310-migration.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/300-to-310-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/310-to-320-migration.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/310-to-320-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/3xx-to-400-migration.vm
      - copied unchanged from r508214, incubator/roller/trunk/metadata/database/3xx-to-400-migration.vm
    incubator/roller/trunk/metadata/database/tmpls/createdb.vm
      - copied, changed from r508214, incubator/roller/trunk/metadata/database/createdb.vm
Removed:
    incubator/roller/trunk/metadata/database/200-to-210-migration.vm
    incubator/roller/trunk/metadata/database/210-to-230-migration.vm
    incubator/roller/trunk/metadata/database/230-to-240-migration.vm
    incubator/roller/trunk/metadata/database/240-to-300-migration.vm
    incubator/roller/trunk/metadata/database/300-to-310-migration.vm
    incubator/roller/trunk/metadata/database/310-to-320-migration.vm
    incubator/roller/trunk/metadata/database/3xx-to-400-migration.vm
    incubator/roller/trunk/metadata/database/createdb.vm
Modified:
    incubator/roller/trunk/apps/planet/build.xml
    incubator/roller/trunk/build.xml
    incubator/roller/trunk/metadata/database/control.vm
    incubator/roller/trunk/properties.xmlf

Modified: incubator/roller/trunk/apps/planet/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/build.xml?view=diff&rev=508630&r1=508629&r2=508630
==============================================================================
--- incubator/roller/trunk/apps/planet/build.xml (original)
+++ incubator/roller/trunk/apps/planet/build.xml Fri Feb 16 14:40:45 2007
@@ -22,10 +22,14 @@
 
     <property file="build.properties" />
     
+    <!-- a pointer to the root of the entire Roller workspace -->
+    <property name="root"             value="${basedir}/../.." />
+    
     <!-- core properties -->
     <property name="build"            value="${basedir}/build" />
     <property name="dist"             value="${basedir}/dist" />
     <property name="lib"              value="${basedir}/lib" />
+    <property name="sql"              value="${basedir}/src/sql" />
     <property name="src"              value="${basedir}/src/java" />
     <property name="tools"            value="${basedir}/../../tools" />
     <property name="test"             value="${basedir}/test/java" />
@@ -38,6 +42,7 @@
     <property name="build.compile.test"             value="${build.compile}/test"/>
     <property name="build.lib"           value="${build}/lib"/>
     <property name="build.webapp"        value="${build}/webapp"/>
+    <property name="build.dbscripts"     value="${build}/dbscripts"/>
     <property name="build.test"          value="${build}/test"/>
     <property name="build.test.reports"  value="${build.test}/reports"/>
     
@@ -271,6 +276,34 @@
     </target>
     
     
+    <!-- generate database scripts -->
+    <target name="gen-dbscripts">
+        
+        <mkdir dir="${build.dbscripts}" />
+        
+        <!-- need a directory for each db to exist before generation can happen -->
+        <mkdir dir="${build.dbscripts}/db2" />
+        <mkdir dir="${build.dbscripts}/derby" />
+        <mkdir dir="${build.dbscripts}/hsqldb" />
+        <mkdir dir="${build.dbscripts}/mssql" />
+        <mkdir dir="${build.dbscripts}/mysql" />
+        <mkdir dir="${build.dbscripts}/oracle" />
+        <mkdir dir="${build.dbscripts}/postgresql" />
+        
+        <taskdef name="texen" 
+                 classname="org.apache.velocity.texen.ant.TexenTask"
+                 classpath="${tools}/lib/velocity-dep-1.4.jar:${root}/metadata/database/:${sql}" />
+                 
+        <texen
+            controlTemplate="control.vm" 
+            contextProperties="${sql}/dbscripts.properties"
+            useClasspath="true"
+            outputDirectory="${build.dbscripts}" 
+            outputFile="README.txt" />
+            
+    </target>
+
+
     <!-- ============================================== -->
     <!-- build code used for unit testing -->
     <target name="build-tests" depends="build" description="Build unit tests">

Added: incubator/roller/trunk/apps/planet/src/sql/control.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/sql/control.vm?view=auto&rev=508630
==============================================================================
--- incubator/roller/trunk/apps/planet/src/sql/control.vm (added)
+++ incubator/roller/trunk/apps/planet/src/sql/control.vm Fri Feb 16 14:40:45 2007
@@ -0,0 +1,24 @@
+README.txt
+
+Database scripts for $DBTYPE.
+
+Follow the installation guide for instructions on setting up your database.
+
+## parse macros file to include it for use
+#parse("macros.vm")
+
+#** Loop through all databases and generate scripts for each one **#
+#set( $dbs = $strings.split($databases, " ") )
+#foreach ( $database in $dbs )
+
+    #set( $db = $properties.load("/${database}.properties") )
+
+    #** Loop through templates and generate sql scripts **#
+    #set( $tmpls = $strings.split($templates, " ") )
+    #foreach ( $template in $tmpls ) 
+        #set($in = "${template}.vm")
+        #set($out = "${database}/${template}.sql")
+        $generator.parse($in, $out) 
+    #end
+
+#end

Added: incubator/roller/trunk/apps/planet/src/sql/createdb.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/sql/createdb.vm?view=auto&rev=508630
==============================================================================
--- incubator/roller/trunk/apps/planet/src/sql/createdb.vm (added)
+++ incubator/roller/trunk/apps/planet/src/sql/createdb.vm Fri Feb 16 14:40:45 2007
@@ -0,0 +1,79 @@
+#** 
+createdb.vm: Velocity template that generates vendor-specific database scripts 
+
+DON'T RUN THIS, IT'S NOT A DATABASE CREATION SCRIPT!!!
+**#
+
+-- Run this script to create the Roller Planet tables in your database.
+
+-- *****************************************************
+-- Create the tables and indices
+
+create table rag_properties (
+    name     varchar(255) not null primary key,
+    value    $db.TEXT_SQL_TYPE
+);
+
+
+create table rag_planet (
+    id              varchar(48) not null primary key,
+    name            varchar(255) not null,
+    handle          varchar(32) not null
+);
+create index ragp_handle_idx on rag_planet(handle);
+
+
+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  $db.TEXT_SQL_TYPE,
+    group_page       varchar(255),
+    max_page_entries integer default 30,
+    max_feed_entries integer default 30,
+    planet_id        varchar(48)
+);
+alter table rag_group add constraint ragg_handle_uq unique ( handle$!db.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     $db.TIMESTAMP_SQL_TYPE,
+    inbound_links    integer default -1,
+    inbound_blogs    integer default -1
+);
+alter table rag_subscription add constraint rags_feed_url_uq unique ( feed_url$!db.INDEXSIZE_LARGE );
+
+
+create table rag_group_subscription (
+    group_id         varchar(48) not null,
+    subscription_id  varchar(48) not null
+);
+create index raggs_gid_idx on rag_group_subscription(group_id); 
+create index raggs_sid_idx on rag_group_subscription(subscription_id); 
+
+
+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        $db.TEXT_SQL_TYPE not null,
+    author           varchar(255),
+    content          $db.TEXT_SQL_TYPE,
+    categories       $db.TEXT_SQL_TYPE,
+    published        $db.TIMESTAMP_SQL_TYPE not null,
+    updated          $db.TIMESTAMP_SQL_TYPE    
+);
+create index rage_sid_idx on rag_entry(subscription_id); 
+
+
+-- *****************************************************
+-- Now add the foreign key relationships
+

Added: incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties?view=auto&rev=508630
==============================================================================
--- incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties (added)
+++ incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties Fri Feb 16 14:40:45 2007
@@ -0,0 +1,8 @@
+
+# properties that control sql script generation
+
+# list all databases to support, separated by spaces
+databases=db2 derby hsqldb mssql mysql oracle postgresql
+
+# list all db templates to generate, separated by spaces
+templates=createdb

Added: incubator/roller/trunk/apps/planet/src/sql/droptables.sql
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/sql/droptables.sql?view=auto&rev=508630
==============================================================================
--- incubator/roller/trunk/apps/planet/src/sql/droptables.sql (added)
+++ incubator/roller/trunk/apps/planet/src/sql/droptables.sql Fri Feb 16 14:40:45 2007
@@ -0,0 +1,22 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+--  contributor license agreements.  The ASF licenses this file to You
+-- 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.  For additional information regarding
+-- copyright in this work, please see the NOTICE file in the top level
+-- directory of this distribution.
+
+drop table rag_entry;
+drop table rag_group_subscription;
+drop table rag_subscription;
+drop table rag_group;
+drop table rag_planet;
+drop table rag_properties;

Modified: incubator/roller/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/build.xml?view=diff&rev=508630&r1=508629&r2=508630
==============================================================================
--- incubator/roller/trunk/build.xml (original)
+++ incubator/roller/trunk/build.xml Fri Feb 16 14:40:45 2007
@@ -122,9 +122,6 @@
         
     </hibernatedoclet>
     
-    <!-- copy database related files -->
-    <antcall target="stage-dbscripts" />
-    
     <!-- allow for custom generation work -->
     &custom-gen-business;
     
@@ -377,12 +374,29 @@
     
 </target>
 
-
+    <!-- ============================================== -->
+    <!-- create distributable components -->
+    <target name="dist" depends="stage-webapp" description="Create Roller Weblogger distributables">
+        
+        <!-- distributable libraries -->
+        <mkdir dir="${ro.dist}/lib" />
+        <copy todir="${ro.dist}/lib" >
+            <fileset dir="${build.lib}" />
+        </copy>
+        
+        <!-- distributable WAR file -->
+        <mkdir dir="${ro.dist}/webapp" />
+        <jar destfile="${ro.dist}/webapp/roller-weblogger.war"
+             basedir="${build.webapp}" />
+             
+    </target>
+    
+    
 <!-- ********************************************************************* -->
 <!-- Stage web application -->
 <!-- ********************************************************************* -->
 	
-<target name="stage-webapp" depends="gen-business, build-business, build-web, copy-webapp, gen-web" description="Stage webapp, including jars">
+<target name="stage-webapp" depends="gen-business, build-business, build-web, gen-dbscripts, copy-webapp, gen-web" description="Stage webapp, including jars">
 </target>
     
 <target name="copy-webapp" depends="build-web" description="Stage webapp without code generation">
@@ -390,11 +404,6 @@
     <mkdir dir="${build.webapp}/WEB-INF/lib"/>
     <mkdir dir="${build.webapp}/WEB-INF/tlds"/>
 
-    <!-- Copy database configs to classpath in staging -->
-    <copy todir="${build.webapp}/WEB-INF/classes">
-        <fileset dir="${basedir}/metadata/database/hibernate" includes="hibernate.cfg.xml"/>
-    </copy>
-
     <!-- Copy WEB-INF contents to staging -->
     <copy todir="${build.webapp}/WEB-INF">
         <fileset dir="${tools.struts}/lib" includes="validator-rules.xml"/>
@@ -444,72 +453,48 @@
         </fileset>
     </copy>
     
+    <!-- copy database script files -->
+    <copy todir="${build.webapp}/WEB-INF/dbscripts">
+        <fileset dir="${build.dbscripts}" />
+    </copy>
+    
     <!-- apply custom web task -->
     &custom-web;
 
 </target>
 
 
-<!-- ********************************************************************* -->
-<!-- Create different versions of database setup script                    -->
-<!-- With this approach we won't have to expand the script all the time.   -->
-<!-- ********************************************************************* -->
-	
-<target name="stage-dbscripts">
-    
-    <property name="dbscripts" value="${build.webapp}/WEB-INF/dbscripts"/>
-
-    <!-- Create database creation script directory -->
-     <mkdir dir="${dbscripts}"/>
-     <copy todir="${dbscripts}">
-         <fileset dir="./metadata/database" includes="droptables.sql"/>
-     </copy>
-    
-     <taskdef name="texen" classname="org.apache.velocity.texen.ant.TexenTask"
-         classpath="${basedir}/tools/lib/velocity-dep-1.4.jar" />
-     <texen 
-         controlTemplate="control.vm" 
-         contextProperties="${basedir}/metadata/database/mysql.properties"
-         templatePath="${basedir}/metadata/database/" 
-         outputDirectory="${build.webapp}/WEB-INF/dbscripts/mysql/" 
-         outputFile="README.txt" />
-     <texen 
-         controlTemplate="control.vm" 
-         contextProperties="${basedir}/metadata/database/postgresql.properties"
-         templatePath="${basedir}/metadata/database/" 
-         outputDirectory="${build.webapp}/WEB-INF/dbscripts/postgresql/" 
-         outputFile="README.txt" />
-     <texen 
-         controlTemplate="control.vm" 
-         contextProperties="${basedir}/metadata/database/hsqldb.properties"
-         templatePath="${basedir}/metadata/database/" 
-         outputDirectory="${build.webapp}/WEB-INF/dbscripts/hsqldb/" 
-         outputFile="README.txt" />
-     <texen 
-         controlTemplate="control.vm" 
-         contextProperties="${basedir}/metadata/database/derby.properties"
-         templatePath="${basedir}/metadata/database/" 
-         outputDirectory="${build.webapp}/WEB-INF/dbscripts/derby/" 
-         outputFile="README.txt" />
-     <texen 
-         controlTemplate="control.vm" 
-         contextProperties="${basedir}/metadata/database/db2.properties"
-         templatePath="${basedir}/metadata/database/" 
-         outputDirectory="${build.webapp}/WEB-INF/dbscripts/db2/" 
-         outputFile="README.txt" />
-     <texen 
-         controlTemplate="control.vm" 
-         contextProperties="${basedir}/metadata/database/oracle.properties"
-         templatePath="${basedir}/metadata/database/" 
-         outputDirectory="${build.webapp}/WEB-INF/dbscripts/oracle/" 
-         outputFile="README.txt" />
-    <texen 
-        controlTemplate="control.vm" 
-        contextProperties="${basedir}/metadata/database/mssql.properties"
-        templatePath="${basedir}/metadata/database/" 
-        outputDirectory="${build.webapp}/WEB-INF/dbscripts/mssql/" 
-        outputFile="README.txt" />
-</target>
+    <!-- ********************************************************************* -->
+    <!-- Create different versions of database setup script                    -->
+    <!-- With this approach we won't have to expand the script all the time.   -->
+    <!-- ********************************************************************* -->
+    
+    <!-- generate database scripts -->
+    <target name="gen-dbscripts">
+        
+        <mkdir dir="${build.dbscripts}" />
+        
+        <!-- need a directory for each db to exist before generation can happen -->
+        <mkdir dir="${build.dbscripts}/db2" />
+        <mkdir dir="${build.dbscripts}/derby" />
+        <mkdir dir="${build.dbscripts}/hsqldb" />
+        <mkdir dir="${build.dbscripts}/mssql" />
+        <mkdir dir="${build.dbscripts}/mysql" />
+        <mkdir dir="${build.dbscripts}/oracle" />
+        <mkdir dir="${build.dbscripts}/postgresql" />
+        
+        <taskdef name="texen" 
+                 classname="org.apache.velocity.texen.ant.TexenTask"
+                 classpath="${ro.tools}/lib/velocity-dep-1.4.jar:${basedir}/metadata/database/:${basedir}/metadata/database/tmpls/" />
+                 
+        <texen
+            controlTemplate="control.vm" 
+            contextProperties="${basedir}/metadata/database/dbscripts.properties"
+            useClasspath="true"
+            outputDirectory="${build.dbscripts}" 
+            outputFile="README.txt" />
+            
+    </target>
 
 
 <!-- ********************************************************************* -->

Modified: incubator/roller/trunk/metadata/database/control.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/control.vm?view=diff&rev=508630&r1=508629&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/control.vm (original)
+++ incubator/roller/trunk/metadata/database/control.vm Fri Feb 16 14:40:45 2007
@@ -1,74 +1,22 @@
 README.txt
 
-Database scripts for $DBTYPE.
-
 Follow the installation guide for instructions on setting up your database.
 
-#** Define templates to be generated **#
-#set( $templates = ["createdb", "200-to-210-migration", "210-to-230-migration", "230-to-240-migration", "240-to-300-migration", "300-to-310-migration", "310-to-320-migration"]) 
-
-
-#**
-Special macro to add table column with default null
-**#
-#macro(addColumnNull $table $column $type)
-#if ($DBTYPE == "ORACLE")
-    alter table $table add $column $type default null;
-#else
-    alter table $table add column $column $type default null;
-#end
-#end
-
-
-#**
-Special macro to add table column with not-null restriction and default value
-**#
-#macro(addColumnNotNull $table $column $type $default)
-#if($DBTYPE == "MYSQL" || $DBTYPE=="HSQDB")
-    alter table $table add column $column $type default $default not null;  
-#elseif ($DBTYPE == "POSTGRESQL")
-    alter table $table add column $column $type;
-    alter table $table alter $column set default $default;
-    update $table set $column=$default;
-    alter table $table alter $column set not null;
-#elseif ($DBTYPE == "HSQLDB")
-    alter table $table add column $column $type default $default not null; 
-#elseif ($DBTYPE == "DERBY" || $DBTYPE == "DB2")
-    alter table $table add column $column $type with default $default not null;
-#elseif ($DBTYPE == "ORACLE")
-    alter table $table add $column $type default $default not null;  
-#end
-#end
-
-
-#**
-Special macro to drop NOT NULL requirement from an 'id' column.
-**#
-#macro(dropNotNullFromTableId $table)
-#if($DBTYPE == "MYSQL")
-    alter table $table drop primary key;
-    alter table $table modify id varchar(48) null;
-#elseif ($DBTYPE == "POSTGRESQL")
-    alter table $table drop constraint "${table}_pkey";
-    alter table $table  alter column id drop not null;
-#elseif ($DBTYPE == "HSQLDB")
-    alter table $table alter column id varchar(48) null;
-#elseif ($DBTYPE == "DERBY" || $DBTYPE == "DB2")
-    alter table $table drop primary key;
-    alter table $table alter column id null;
-#elseif ($DBTYPE == "ORACLE")
-    alter table $table drop id not null;
-#end
-#end
+## parse macros file to include it for use
+#parse("macros.vm")
 
-#**
-Macro to account for lack of comparable long varchar in MySQL
-**#
-#macro(longtext $size) #if($DBTYPE == "MYSQL") text #else varchar($size) #end #end
+#** Loop through all databases and generate scripts for each one **#
+#set( $dbs = $strings.split($databases, " ") )
+#foreach ( $database in $dbs )
+
+    #set( $db = $properties.load("/${database}.properties") )
+
+    #** Loop through templates and generate sql scripts **#
+    #set( $tmpls = $strings.split($templates, " ") )
+    #foreach ( $template in $tmpls ) 
+        #set($in = "${template}.vm")
+        #set($out = "${database}/${template}.sql")
+        $generator.parse($in, $out) 
+    #end
 
-#** Loop through templates, generate database scripts **#
-#foreach ($template in $templates) 
-    #set($in = "${template}.vm")
-    #set($out = "${template}.sql")
-    $generator.parse($in, $out) 
 #end

Added: incubator/roller/trunk/metadata/database/dbscripts.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/dbscripts.properties?view=auto&rev=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/dbscripts.properties (added)
+++ incubator/roller/trunk/metadata/database/dbscripts.properties Fri Feb 16 14:40:45 2007
@@ -0,0 +1,11 @@
+
+# properties that control sql script generation
+
+# list all databases to support, separated by spaces
+databases=db2 derby hsqldb mssql mysql oracle postgresql
+
+# list all db templates to generate, separated by spaces
+templates=createdb 200-to-210-migration 210-to-230-migration \
+230-to-240-migration 240-to-300-migration 300-to-310-migration \
+310-to-320-migration
+

Added: incubator/roller/trunk/metadata/database/macros.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/macros.vm?view=auto&rev=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/macros.vm (added)
+++ incubator/roller/trunk/metadata/database/macros.vm Fri Feb 16 14:40:45 2007
@@ -0,0 +1,58 @@
+
+#**
+Special macro to add table column with default null
+**#
+#macro(addColumnNull $table $column $type)
+#if ($db.DBTYPE == "ORACLE")
+    alter table $table add $column $type default null;
+#else
+    alter table $table add column $column $type default null;
+#end
+#end
+
+
+#**
+Special macro to add table column with not-null restriction and default value
+**#
+#macro(addColumnNotNull $table $column $type $default)
+#if($db.DBTYPE == "MYSQL" || $db.DBTYPE=="HSQDB")
+    alter table $table add column $column $type default $default not null;  
+#elseif ($db.DBTYPE == "POSTGRESQL")
+    alter table $table add column $column $type;
+    alter table $table alter $column set default $default;
+    update $table set $column=$default;
+    alter table $table alter $column set not null;
+#elseif ($db.DBTYPE == "HSQLDB")
+    alter table $table add column $column $type default $default not null; 
+#elseif ($db.DBTYPE == "DERBY" || $db.DBTYPE == "DB2")
+    alter table $table add column $column $type with default $default not null;
+#elseif ($db.DBTYPE == "ORACLE")
+    alter table $table add $column $type default $default not null;  
+#end
+#end
+
+
+#**
+Special macro to drop NOT NULL requirement from an 'id' column.
+**#
+#macro(dropNotNullFromTableId $table)
+#if($db.DBTYPE == "MYSQL")
+    alter table $table drop primary key;
+    alter table $table modify id varchar(48) null;
+#elseif ($db.DBTYPE == "POSTGRESQL")
+    alter table $table drop constraint "${table}_pkey";
+    alter table $table  alter column id drop not null;
+#elseif ($db.DBTYPE == "HSQLDB")
+    alter table $table alter column id varchar(48) null;
+#elseif ($db.DBTYPE == "DERBY" || $db.DBTYPE == "DB2")
+    alter table $table drop primary key;
+    alter table $table alter column id null;
+#elseif ($db.DBTYPE == "ORACLE")
+    alter table $table drop id not null;
+#end
+#end
+
+#**
+Macro to account for lack of comparable long varchar in MySQL
+**#
+#macro(longtext $size) #if($db.DBTYPE == "MYSQL") text #else varchar($size) #end #end

Copied: incubator/roller/trunk/metadata/database/tmpls/200-to-210-migration.vm (from r508214, incubator/roller/trunk/metadata/database/200-to-210-migration.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/200-to-210-migration.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/200-to-210-migration.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/200-to-210-migration.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/200-to-210-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/200-to-210-migration.vm Fri Feb 16 14:40:45 2007
@@ -5,17 +5,17 @@
 **#
 
 -- Add to roller_comment table: approved and pending fields
-#addColumnNotNull("roller_comment" "approved" $BOOLEAN_SQL_TYPE $BOOLEAN_TRUE)
-#addColumnNotNull("roller_comment" "pending" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
-update roller_comment set approved=$BOOLEAN_TRUE, pending=$BOOLEAN_FALSE, posttime=posttime;
+#addColumnNotNull("roller_comment" "approved" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_TRUE)
+#addColumnNotNull("roller_comment" "pending" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_FALSE)
+update roller_comment set approved=$db.BOOLEAN_TRUE, pending=$db.BOOLEAN_FALSE, posttime=posttime;
 
 -- Add to website table: commentmod, blacklist, defaultallowcomments and defaultcommentdays 
-#addColumnNotNull("website" "commentmod" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
-#addColumnNotNull("website" "defaultallowcomments" $BOOLEAN_SQL_TYPE $BOOLEAN_TRUE)
+#addColumnNotNull("website" "commentmod" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_FALSE)
+#addColumnNotNull("website" "defaultallowcomments" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_TRUE)
 #addColumnNotNull("website" "defaultcommentdays" "integer" 7)
-#addColumnNull("website" "blacklist" $TEXT_SQL_TYPE)
+#addColumnNull("website" "blacklist" $db.TEXT_SQL_TYPE)
 
-update website set commentmod=$BOOLEAN_FALSE, defaultallowcomments=$BOOLEAN_TRUE, defaultcommentdays=7, blacklist='', datecreated=datecreated;
+update website set commentmod=$db.BOOLEAN_FALSE, defaultallowcomments=$db.BOOLEAN_TRUE, defaultcommentdays=7, blacklist='', datecreated=datecreated;
 
 -- Add weblog displaydays column
 #addColumnNotNull("website" "displaycnt" "integer" 15)

Copied: incubator/roller/trunk/metadata/database/tmpls/210-to-230-migration.vm (from r508214, incubator/roller/trunk/metadata/database/210-to-230-migration.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/210-to-230-migration.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/210-to-230-migration.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/210-to-230-migration.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/210-to-230-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/210-to-230-migration.vm Fri Feb 16 14:40:45 2007
@@ -6,12 +6,12 @@
 
 -- Roller 2.2 schema changes
 
-#addColumnNotNull("website" "isactive" $BOOLEAN_SQL_TYPE $BOOLEAN_TRUE)
-update website set isactive=$BOOLEAN_TRUE, datecreated=datecreated;
+#addColumnNotNull("website" "isactive" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_TRUE)
+update website set isactive=$db.BOOLEAN_TRUE, datecreated=datecreated;
 
 -- Roller 2.3 schema changes
 
-#addColumnNull("weblogentry" "summary" $TEXT_SQL_TYPE)
+#addColumnNull("weblogentry" "summary" $db.TEXT_SQL_TYPE)
 #addColumnNull("weblogentry" "content_type" "varchar(48)")
 #addColumnNull("weblogentry" "content_src" "varchar(255)")
 

Copied: incubator/roller/trunk/metadata/database/tmpls/230-to-240-migration.vm (from r508214, incubator/roller/trunk/metadata/database/230-to-240-migration.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/230-to-240-migration.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/230-to-240-migration.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/230-to-240-migration.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/230-to-240-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/230-to-240-migration.vm Fri Feb 16 14:40:45 2007
@@ -6,6 +6,6 @@
 
 -- Roller 2.4 schema changes
 
-#addColumnNotNull("pingtarget" "autoenabled" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
+#addColumnNotNull("pingtarget" "autoenabled" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_FALSE)
 
-#addColumnNull("website" "lastmodified" $TIMESTAMP_SQL_TYPE)
+#addColumnNull("website" "lastmodified" $db.TIMESTAMP_SQL_TYPE)

Copied: incubator/roller/trunk/metadata/database/tmpls/240-to-300-migration.vm (from r508214, incubator/roller/trunk/metadata/database/240-to-300-migration.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/240-to-300-migration.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/240-to-300-migration.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/240-to-300-migration.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/240-to-300-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/240-to-300-migration.vm Fri Feb 16 14:40:45 2007
@@ -10,8 +10,8 @@
 #addColumnNull("website" "pagemodels" "varchar(512)")
 
 -- add new columns which hold the multi-lang settings for a weblog
-#addColumnNotNull("website" "enablemultilang" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
-#addColumnNotNull("website" "showalllangs" $BOOLEAN_SQL_TYPE $BOOLEAN_TRUE)
+#addColumnNotNull("website" "enablemultilang" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_FALSE)
+#addColumnNotNull("website" "showalllangs" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_TRUE)
 
 -- add new column which holds the locale for a weblog entry
 -- then set the values and make column not null
@@ -19,12 +19,12 @@
 create index we_locale_idx on weblogentry(locale);
 
 -- add new column which holds the hidden status for a page, default is false
-#addColumnNotNull("webpage" "hidden" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
+#addColumnNotNull("webpage" "hidden" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_FALSE)
 
 -- add new column which holds the hidden status for a page, default is false
-#addColumnNotNull("webpage" "navbar" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
-update webpage set navbar=$BOOLEAN_TRUE;
-update webpage set navbar=$BOOLEAN_FALSE where name like '\_%';
+#addColumnNotNull("webpage" "navbar" $db.BOOLEAN_SQL_TYPE $db.BOOLEAN_FALSE)
+update webpage set navbar=$db.BOOLEAN_TRUE;
+update webpage set navbar=$db.BOOLEAN_FALSE where name like '\_%';
 
 -- add new column which holds the template language used for a page
 -- then set template language to velocity for all templates

Copied: incubator/roller/trunk/metadata/database/tmpls/300-to-310-migration.vm (from r508214, incubator/roller/trunk/metadata/database/300-to-310-migration.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/300-to-310-migration.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/300-to-310-migration.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/300-to-310-migration.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/300-to-310-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/300-to-310-migration.vm Fri Feb 16 14:40:45 2007
@@ -10,7 +10,7 @@
     websiteid       varchar(48)   not null,    
     userid		    varchar(48)  not null,
     name            varchar(255)  not null,
-    time            $TIMESTAMP_SQL_TYPE 	not null
+    time            $db.TIMESTAMP_SQL_TYPE 	not null
 );
 
 create index wet_entryid_idx on roller_weblogentrytag( entryid );
@@ -23,7 +23,7 @@
     websiteid       varchar(48) ,    
     name            varchar(255)  not null,
     total           integer		  not null,
-    lastused        $TIMESTAMP_SQL_TYPE 	not null
+    lastused        $db.TIMESTAMP_SQL_TYPE 	not null
 );
 
 create index weta_websiteid_idx on roller_weblogentrytagagg( websiteid );
@@ -33,12 +33,12 @@
 create table roller_tasklock (
     id              varchar(48)   not null primary key,
     name            varchar(255)  not null,
-    islocked        $BOOLEAN_SQL_TYPE_FALSE,
-    timeacquired    $TIMESTAMP_SQL_TYPE_NULL,
+    islocked        $db.BOOLEAN_SQL_TYPE_FALSE,
+    timeacquired    $db.TIMESTAMP_SQL_TYPE_NULL,
     timeleased	    integer,
-    lastrun         $TIMESTAMP_SQL_TYPE_NULL
+    lastrun         $db.TIMESTAMP_SQL_TYPE_NULL
 );
-alter table roller_tasklock add constraint rtl_name_uq unique ( name$!INDEXSIZE );
+alter table roller_tasklock add constraint rtl_name_uq unique ( name$!db.INDEXSIZE );
 
 create table roller_hitcounts (
     id              varchar(48) not null primary key,

Copied: incubator/roller/trunk/metadata/database/tmpls/310-to-320-migration.vm (from r508214, incubator/roller/trunk/metadata/database/310-to-320-migration.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/310-to-320-migration.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/310-to-320-migration.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/310-to-320-migration.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/310-to-320-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/310-to-320-migration.vm Fri Feb 16 14:40:45 2007
@@ -63,7 +63,7 @@
 
 -- some missing foreign key constraints
 alter table roller_user_permissions add constraint up_userid_fk
-    foreign key ( user_id ) references rolleruser( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( user_id ) references rolleruser( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table roller_user_permissions add constraint up_websiteid_fk
-    foreign key ( website_id ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( website_id ) references website( id ) $!db.ADDL_FK_PARAMS ;

Copied: incubator/roller/trunk/metadata/database/tmpls/createdb.vm (from r508214, incubator/roller/trunk/metadata/database/createdb.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/tmpls/createdb.vm?view=diff&rev=508630&p1=incubator/roller/trunk/metadata/database/createdb.vm&r1=508214&p2=incubator/roller/trunk/metadata/database/tmpls/createdb.vm&r2=508630
==============================================================================
--- incubator/roller/trunk/metadata/database/createdb.vm (original)
+++ incubator/roller/trunk/metadata/database/tmpls/createdb.vm Fri Feb 16 14:40:45 2007
@@ -15,12 +15,12 @@
     passphrase      varchar(255) not null,
     fullname        varchar(255) not null,
     emailaddress    varchar(255) not null,
-    datecreated     $TIMESTAMP_SQL_TYPE not null,
+    datecreated     $db.TIMESTAMP_SQL_TYPE not null,
     locale          varchar(20),  
     timezone        varchar(50),    
-    isenabled       $BOOLEAN_SQL_TYPE_TRUE not null
+    isenabled       $db.BOOLEAN_SQL_TYPE_TRUE not null
 );
-alter table rolleruser add constraint ru_username_uq unique ( username$!INDEXSIZE );
+alter table rolleruser add constraint ru_username_uq unique ( username$!db.INDEXSIZE );
 
 create table userrole (
     id               varchar(48) not null primary key,
@@ -29,7 +29,7 @@
     userid           varchar(48) not null
 );
 create index ur_userid_idx on userrole( userid );
-create index ur_username_idx on userrole( username$!INDEXSIZE );
+create index ur_username_idx on userrole( username$!db.INDEXSIZE );
 
 -- User permissions within a website
 -- permission_mask: bitmask 000 limited, 001 author, 011 admin
@@ -39,7 +39,7 @@
     website_id      varchar(48) not null,
     user_id         varchar(48) not null,
     permission_mask integer not null, 
-    pending         $BOOLEAN_SQL_TYPE_TRUE not null
+    pending         $db.BOOLEAN_SQL_TYPE_TRUE not null
 );
 
 -- Audit log records time and comment about change
@@ -54,17 +54,17 @@
     object_id       varchar(48),           
     object_class    varchar(255),          
     comment_text    varchar(255) not null, 
-    change_time     $TIMESTAMP_SQL_TYPE              
+    change_time     $db.TIMESTAMP_SQL_TYPE              
 );
 
 create table usercookie (
     id              varchar(48) not null primary key,
     username        varchar(255) not null,
     cookieid        varchar(100) not null,
-    datecreated     $TIMESTAMP_SQL_TYPE not null
+    datecreated     $db.TIMESTAMP_SQL_TYPE not null
 );
-create index uc_username_idx on usercookie( username$!INDEXSIZE );
-create index uc_cookieid_idx on usercookie( cookieid$!INDEXSIZE );
+create index uc_username_idx on usercookie( username$!db.INDEXSIZE );
+create index uc_cookieid_idx on usercookie( cookieid$!db.INDEXSIZE );
 
 create table webpage (
     id              varchar(48)  not null primary key,
@@ -72,15 +72,15 @@
     description     varchar(255),
     link            varchar(255),
     websiteid       varchar(48) not null,
-    template        $TEXT_SQL_TYPE not null,
-    updatetime      $TIMESTAMP_SQL_TYPE not null,
-    hidden          $BOOLEAN_SQL_TYPE_FALSE not null,
-    navbar          $BOOLEAN_SQL_TYPE_FALSE not null,
+    template        $db.TEXT_SQL_TYPE not null,
+    updatetime      $db.TIMESTAMP_SQL_TYPE not null,
+    hidden          $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    navbar          $db.BOOLEAN_SQL_TYPE_FALSE not null,
     templatelang    varchar(20) not null,
     decorator       varchar(255) default null
 );
-create index wp_name_idx on webpage( name$!INDEXSIZE );
-create index wp_link_idx on webpage( link$!INDEXSIZE );
+create index wp_name_idx on webpage( name$!db.INDEXSIZE );
+create index wp_link_idx on webpage( link$!db.INDEXSIZE );
 create index wp_id_idx on webpage( websiteid );
 
 create table website (
@@ -91,35 +91,35 @@
     userid            varchar(48) not null,
     defaultpageid     varchar(48) default '',
     weblogdayid       varchar(48) not null,
-    ignorewords       $TEXT_SQL_TYPE,
-    enablebloggerapi  $BOOLEAN_SQL_TYPE_FALSE not null,
+    ignorewords       $db.TEXT_SQL_TYPE,
+    enablebloggerapi  $db.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,
+    allowcomments     $db.BOOLEAN_SQL_TYPE_TRUE not null,
+    emailcomments     $db.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),
-    isenabled         $BOOLEAN_SQL_TYPE_TRUE not null,
-    isactive          $BOOLEAN_SQL_TYPE_TRUE not null,
-    datecreated          $TIMESTAMP_SQL_TYPE not null,
-    blacklist            $TEXT_SQL_TYPE,
-    defaultallowcomments $BOOLEAN_SQL_TYPE_TRUE not null,
+    isenabled         $db.BOOLEAN_SQL_TYPE_TRUE not null,
+    isactive          $db.BOOLEAN_SQL_TYPE_TRUE not null,
+    datecreated          $db.TIMESTAMP_SQL_TYPE not null,
+    blacklist            $db.TEXT_SQL_TYPE,
+    defaultallowcomments $db.BOOLEAN_SQL_TYPE_TRUE not null,
     defaultcommentdays   integer default 7 not null,
-    commentmod           $BOOLEAN_SQL_TYPE_FALSE not null,
+    commentmod           $db.BOOLEAN_SQL_TYPE_FALSE not null,
     displaycnt           integer default 15 not null,
-    lastmodified         $TIMESTAMP_SQL_TYPE,
+    lastmodified         $db.TIMESTAMP_SQL_TYPE,
     pagemodels           varchar(255) default null,
-    enablemultilang   $BOOLEAN_SQL_TYPE_FALSE not null,
-    showalllangs      $BOOLEAN_SQL_TYPE_TRUE not null
+    enablemultilang   $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    showalllangs      $db.BOOLEAN_SQL_TYPE_TRUE not null
 );
 create index ws_userid_idx    on website(userid);
 create index ws_isenabled_idx on website(isenabled);
-alter table website add constraint ws_handle_uq unique (handle$!INDEXSIZE);
+alter table website add constraint ws_handle_uq unique (handle$!db.INDEXSIZE);
 
 -- This index is not necessary because of handle is already a primary key.
 -- create index ws_handle_idx    on website(handle);
@@ -187,21 +187,21 @@
     userid          varchar(48) not null,
     anchor          varchar(255)  not null,
     title           varchar(255)  not null,
-    text            $TEXT_SQL_TYPE not null,
-    pubtime         $TIMESTAMP_SQL_TYPE_NULL,
-    updatetime      $TIMESTAMP_SQL_TYPE     not null,
+    text            $db.TEXT_SQL_TYPE not null,
+    pubtime         $db.TIMESTAMP_SQL_TYPE_NULL,
+    updatetime      $db.TIMESTAMP_SQL_TYPE     not null,
     websiteid       varchar(48)  not null,
     categoryid      varchar(48)  not null,
-    publishentry    $BOOLEAN_SQL_TYPE_TRUE not null,
+    publishentry    $db.BOOLEAN_SQL_TYPE_TRUE not null,
     link            varchar(255),
     plugins         varchar(255),
-    allowcomments   $BOOLEAN_SQL_TYPE_FALSE not null, 
+    allowcomments   $db.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,
+    rightToLeft     $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    pinnedtomain    $db.BOOLEAN_SQL_TYPE_FALSE not null,
     locale          varchar(20),
     status          varchar(20) not null,
-    summary         $TEXT_SQL_TYPE default null, 
+    summary         $db.TEXT_SQL_TYPE default null, 
     content_type    varchar(48) default null, 
     content_src     varchar(255) default null
 );
@@ -220,7 +220,7 @@
     websiteid       varchar(48)   not null,    
     userid		    varchar(48)   not null,
     name            varchar(255)  not null,
-    time            $TIMESTAMP_SQL_TYPE 	not null
+    time            $db.TIMESTAMP_SQL_TYPE 	not null
 );
 
 create index wet_entryid_idx on roller_weblogentrytag( entryid );
@@ -233,7 +233,7 @@
     websiteid       varchar(48) ,    
     name            varchar(255)  not null,
     total           integer		  not null,
-    lastused        $TIMESTAMP_SQL_TYPE 	not null
+    lastused        $db.TIMESTAMP_SQL_TYPE 	not null
 );
 
 create index weta_websiteid_idx on roller_weblogentrytagagg( websiteid );
@@ -256,13 +256,13 @@
     name       varchar(255),
     email      varchar(255),
     url        varchar(255),
-    content    $TEXT_SQL_TYPE,
-    posttime   $TIMESTAMP_SQL_TYPE   not null,
-    spam       $BOOLEAN_SQL_TYPE_FALSE not null,
-    notify     $BOOLEAN_SQL_TYPE_FALSE not null,
+    content    $db.TEXT_SQL_TYPE,
+    posttime   $db.TIMESTAMP_SQL_TYPE   not null,
+    spam       $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    notify     $db.BOOLEAN_SQL_TYPE_FALSE not null,
     remotehost varchar(128),
-    pending    $BOOLEAN_SQL_TYPE_TRUE not null,
-    approved   $BOOLEAN_SQL_TYPE_FALSE not null,
+    pending    $db.BOOLEAN_SQL_TYPE_TRUE not null,
+    approved   $db.BOOLEAN_SQL_TYPE_FALSE not null,
     referrer   varchar(255),
     useragent  varchar(255),
     status     varchar(20) not null
@@ -282,8 +282,8 @@
     pingurl      varchar(255) not null,
     websiteid    varchar(48),
     conditioncode    integer default 0 not null,
-    lastsuccess  $TIMESTAMP_SQL_TYPE,
-    autoenabled  $BOOLEAN_SQL_TYPE_FALSE not null
+    lastsuccess  $db.TIMESTAMP_SQL_TYPE,
+    autoenabled  $db.BOOLEAN_SQL_TYPE_FALSE not null
 );
 create index pt_websiteid_idx on pingtarget( websiteid );
 
@@ -314,7 +314,7 @@
 -- attempts:  number of ping attempts that have been made for this entry
 create table pingqueueentry (
     id             varchar(48) not null primary key,
-    entrytime      $TIMESTAMP_SQL_TYPE not null, 
+    entrytime      $db.TIMESTAMP_SQL_TYPE not null, 
     pingtargetid   varchar(48) not null,  
     websiteid      varchar(48) not null,  
     attempts       integer not null
@@ -332,21 +332,21 @@
     datestr   varchar(10),
     refurl    varchar(255) not null,
     refpermalink varchar(255),
-    reftime   $TIMESTAMP_SQL_TYPE,
+    reftime   $db.TIMESTAMP_SQL_TYPE,
     requrl    varchar(255),
     title     varchar(255),
-    excerpt   $TEXT_SQL_TYPE,
+    excerpt   $db.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
+    visible   $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    duplicate $db.BOOLEAN_SQL_TYPE_FALSE not null
 );
 create index ref_websiteid_idx on referer( websiteid );
 create index ref_entryid_idx on referer( entryid );
-create index ref_refurl_idx on referer( refurl$!INDEXSIZE );
-create index ref_requrl_idx on referer( requrl$!INDEXSIZE );
+create index ref_refurl_idx on referer( refurl$!db.INDEXSIZE );
+create index ref_requrl_idx on referer( requrl$!db.INDEXSIZE );
 create index ref_datestr_idx on referer( datestr );
-create index ref_refpermlnk_idx on referer( refpermalink$!INDEXSIZE );
+create index ref_refpermlnk_idx on referer( refpermalink$!db.INDEXSIZE );
 create index ref_duplicate_idx on referer( duplicate );
 
 -- Configuration options for Roller, should only ever be one row
@@ -358,46 +358,46 @@
     emailaddress    varchar(255),
     absoluteurl     varchar(255),
     adminusers      varchar(255),
-    encryptpasswords $BOOLEAN_SQL_TYPE_TRUE not null,
+    encryptpasswords $db.BOOLEAN_SQL_TYPE_TRUE not null,
     algorithm       varchar(10),
-    newuserallowed  $BOOLEAN_SQL_TYPE_FALSE not null,
+    newuserallowed  $db.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,
+    memdebug        $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    autoformatcomments $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    escapecommenthtml $db.BOOLEAN_SQL_TYPE_TRUE not null,
+    emailcomments   $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    enableaggregator $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    enablelinkback  $db.BOOLEAN_SQL_TYPE_FALSE not null,
     rsscachetime    integer default 3000 not null,
-    rssusecache     $BOOLEAN_SQL_TYPE_TRUE not null,
+    rssusecache     $db.BOOLEAN_SQL_TYPE_TRUE not null,
     uploadallow     varchar(255),
     uploadforbid    varchar(255),
-    uploadenabled   $BOOLEAN_SQL_TYPE_TRUE not null,
+    uploadenabled   $db.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
+    refspamwords    $db.TEXT_SQL_TYPE
 );
 
 create table roller_properties (
     name     varchar(255) not null primary key,
-    value    $TEXT_SQL_TYPE
+    value    $db.TEXT_SQL_TYPE
 );
 
 create table roller_tasklock (
     id              varchar(48)   not null primary key,
     name            varchar(255)  not null,
-    islocked        $BOOLEAN_SQL_TYPE_FALSE,
-    timeacquired    $TIMESTAMP_SQL_TYPE_NULL,
+    islocked        $db.BOOLEAN_SQL_TYPE_FALSE,
+    timeacquired    $db.TIMESTAMP_SQL_TYPE_NULL,
     timeleased	    integer,
-    lastrun         $TIMESTAMP_SQL_TYPE_NULL,
+    lastrun         $db.TIMESTAMP_SQL_TYPE_NULL,
     client          varchar(255)
 );
-alter table roller_tasklock add constraint rtl_name_uq unique ( name$!INDEXSIZE );
+alter table roller_tasklock add constraint rtl_name_uq unique ( name$!db.INDEXSIZE );
 create index rtl_taskname_idx on roller_tasklock( name );
 
 create table roller_hitcounts (
@@ -413,10 +413,10 @@
     id       varchar(48) not null primary key,
     entryid  varchar(48) not null,
     name     varchar(255) not null,
-    value    $TEXT_SQL_TYPE not null
+    value    $db.TEXT_SQL_TYPE not null
 );
 create index ea_entryid_idx on entryattribute( entryid );
-alter table entryattribute add constraint ea_name_uq unique ( entryid, name$!INDEXSIZE );
+alter table entryattribute add constraint ea_name_uq unique ( entryid, name$!db.INDEXSIZE );
 
 create table rag_group_subscription (
     group_id         varchar(48) not null,
@@ -444,7 +444,7 @@
 
 create table rag_properties (
     name     varchar(255) not null primary key,
-    value    $TEXT_SQL_TYPE
+    value    $db.TEXT_SQL_TYPE
 );
 
 create table rag_planet (
@@ -459,13 +459,13 @@
     handle           varchar(255) not null,
     title            varchar(255) not null,
     description      varchar(255),
-    cat_restriction  $TEXT_SQL_TYPE,
+    cat_restriction  $db.TEXT_SQL_TYPE,
     group_page       varchar(255),
     max_page_entries integer default 30,
     max_feed_entries integer default 30,
     planet_id        varchar(48)
 );
-alter table rag_group add constraint ragg_handle_uq unique ( handle$!INDEXSIZE );
+alter table rag_group add constraint ragg_handle_uq unique ( handle$!db.INDEXSIZE );
 
 create table rag_subscription (
     id               varchar(48) not null primary key,
@@ -473,11 +473,11 @@
     feed_url         varchar(255) not null,
     site_url         varchar(255),
     author           varchar(255),
-    last_updated     $TIMESTAMP_SQL_TYPE,
+    last_updated     $db.TIMESTAMP_SQL_TYPE,
     inbound_links    integer default -1,
     inbound_blogs    integer default -1
 );
-alter table rag_subscription add constraint rags_feed_url_uq unique ( feed_url$!INDEXSIZE_LARGE );
+alter table rag_subscription add constraint rags_feed_url_uq unique ( feed_url$!db.INDEXSIZE_LARGE );
 
 create table rag_entry (
     id               varchar(48) not null primary key,
@@ -485,12 +485,12 @@
     handle           varchar(255),
     title            varchar(255),
     guid             varchar(255),
-    permalink        $TEXT_SQL_TYPE not null,
+    permalink        $db.TEXT_SQL_TYPE not null,
     author           varchar(255),
-    content          $TEXT_SQL_TYPE,
-    categories       $TEXT_SQL_TYPE,
-    published        $TIMESTAMP_SQL_TYPE not null,
-    updated          $TIMESTAMP_SQL_TYPE    
+    content          $db.TEXT_SQL_TYPE,
+    categories       $db.TEXT_SQL_TYPE,
+    published        $db.TIMESTAMP_SQL_TYPE not null,
+    updated          $db.TIMESTAMP_SQL_TYPE    
 );
 create index rage_sid_idx on rag_entry(subscription_id); 
 
@@ -501,77 +501,77 @@
 -- user, role, website, and permissions
 
 alter table website add constraint ws_userid_fk
-    foreign key ( userid ) references rolleruser ( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( userid ) references rolleruser ( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table userrole add constraint ur_userid_fk
-    foreign key ( userid ) references rolleruser( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( userid ) references rolleruser( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table roller_user_permissions add constraint up_userid_fk
-    foreign key ( user_id ) references rolleruser( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( user_id ) references rolleruser( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table roller_user_permissions add constraint up_websiteid_fk
-    foreign key ( website_id ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( website_id ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 -- page, entry, category, comment
 
 alter table webpage add constraint wp_websiteid_fk
-    foreign key ( websiteid ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( websiteid ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table weblogentry add constraint we_websiteid_fk
-    foreign key ( websiteid ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( websiteid ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table weblogentry add constraint wc_categoryid_fk
-    foreign key ( categoryid ) references weblogcategory( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( categoryid ) references weblogcategory( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table weblogcategory add constraint wc_websiteid_fk
-    foreign key ( websiteid ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( websiteid ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table roller_comment add constraint co_entryid_fk
-    foreign key ( entryid ) references weblogentry( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( entryid ) references weblogentry( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table entryattribute add constraint att_entryid_fk
-    foreign key ( entryid ) references weblogentry( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( entryid ) references weblogentry( id ) $!db.ADDL_FK_PARAMS ;
 
 -- referer
 
 alter table referer add constraint ref_entryid_fk
-    foreign key ( entryid ) references weblogentry( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( entryid ) references weblogentry( id ) $!db.ADDL_FK_PARAMS ;
 
 alter table referer add constraint ref_websiteid_fk
-    foreign key ( websiteid ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( websiteid ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 -- folder and bookmark
 
 alter table folder add constraint fo_websiteid_fk
-    foreign key ( websiteid ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( websiteid ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 -- alter table folder add constraint fo_parentid_fk
 --     foreign key ( parentid ) references folder( id );
 
 alter table bookmark add constraint bm_folderid_fk
-    foreign key ( folderid ) references folder( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( folderid ) references folder( id ) $!db.ADDL_FK_PARAMS ;
 
 -- newsfeed
 
 alter table newsfeed add constraint nf_websiteid_fk
-    foreign key ( websiteid ) references website( id ) $!ADDL_FK_PARAMS ;
+    foreign key ( websiteid ) references website( id ) $!db.ADDL_FK_PARAMS ;
 
 -- pingtarget, autoping, pingcategory
 
 alter table pingtarget add constraint pt_websiteid_fk
-    foreign key (websiteid) references website(id) $!ADDL_FK_PARAMS ;
+    foreign key (websiteid) references website(id) $!db.ADDL_FK_PARAMS ;
 
 alter table autoping add constraint ap_websiteid_fk
-    foreign key (websiteid) references website(id) $!ADDL_FK_PARAMS ;
+    foreign key (websiteid) references website(id) $!db.ADDL_FK_PARAMS ;
 
 alter table autoping add constraint ap_pingtargetid_fk
-    foreign key (pingtargetid) references pingtarget(id) $!ADDL_FK_PARAMS ;
+    foreign key (pingtargetid) references pingtarget(id) $!db.ADDL_FK_PARAMS ;
 
 alter table pingcategory add constraint pc_autopingid_fk
-    foreign key (autopingid) references autoping(id) $!ADDL_FK_PARAMS ;
+    foreign key (autopingid) references autoping(id) $!db.ADDL_FK_PARAMS ;
 
 alter table pingcategory add constraint pc_categoryid_fk
-    foreign key (categoryid) references weblogcategory(id) $!ADDL_FK_PARAMS ;
+    foreign key (categoryid) references weblogcategory(id) $!db.ADDL_FK_PARAMS ;
 
 
 -- THE FOLLOWING CONSTRAINTS CAN NOT BE SUPPORTED FOR IMPORTING new-user.xml

Modified: incubator/roller/trunk/properties.xmlf
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/properties.xmlf?view=diff&rev=508630&r1=508629&r2=508630
==============================================================================
--- incubator/roller/trunk/properties.xmlf (original)
+++ incubator/roller/trunk/properties.xmlf Fri Feb 16 14:40:45 2007
@@ -43,6 +43,7 @@
 <property name="build.dist.apache"   value="${build.dist}/apache"/>
 <property name="build.dist.binary"   value="${build.dist}/apache-roller-${ro.version}"/>
 <property name="build.dist.sources"  value="${build.dist}/apache-roller-src-${ro.version}"/>
+<property name="build.dbscripts"     value="${ro.build}/dbscripts"/>
 <property name="build.tests"         value="${ro.build}/tests"/>
 <property name="build.reports"       value="${build.tests}/reports"/>
 <property name="build.docs"          value="${ro.build}/docs"/>



Re: svn commit: r508630 - in /incubator/roller/trunk: ./ apps/planet/ apps/planet/src/sql/ metadata/database/ metadata/database/tmpls/

Posted by Matt Raible <mr...@gmail.com>.
On 2/20/07, Allen Gilliland <al...@sun.com> wrote:
> yes, templates would have been better, I guess I was just being really
> lazy for some reason :/
>
> part of it was that i didn't care that much about the name because I
> expect that directory to be moved once we migrate the weblogger code to
> the correct place in the new blueprints workspace layout.  so like the
> planet app, the weblogger code will go under /apps/weblogger and the sql
> script templates will be in /apps/weblogger/src/sql/, so it was really
> just chosen as a temporary name until that happens.

I'd rather to Maven's workspace layout than the blueprints layout.  I
believe as an Apache project - we should follow the path that everyone
else uses. ;-)

Matt

>
> i can rename it to "templates" though, since that is a better name.
>
> -- Allen
>
>
> Dave wrote:
> > On 2/16/07, agilliland@apache.org <ag...@apache.org> wrote:
> >> Author: agilliland
> >> Date: Fri Feb 16 14:40:45 2007
> >> New Revision: 508630
> >>
> >> URL: http://svn.apache.org/viewvc?view=rev&rev=508630
> >> Log:
> >> fixing up Roller dbscript generation process to allow for independent
> >> db script generation for Planet and Weblogger apps.  Each application
> >> can now maintain and generate it's own db scripts indpendently of the
> >> other app.
> >>
> >> NOTE: this doesn't solve the issue of how to properly include the
> >> planet scripts with the weblogger scripts, that will be tackled in a
> >> subsequent commit.
> >>
> >> Added:
> >>     incubator/roller/trunk/apps/planet/src/sql/
> >>     incubator/roller/trunk/apps/planet/src/sql/control.vm
> >>     incubator/roller/trunk/apps/planet/src/sql/createdb.vm
> >>     incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties
> >>     incubator/roller/trunk/apps/planet/src/sql/droptables.sql
> >>     incubator/roller/trunk/metadata/database/dbscripts.properties
> >>     incubator/roller/trunk/metadata/database/macros.vm
> >>     incubator/roller/trunk/metadata/database/tmpls/
> >
> > No object to the re-org and cleanup, but can't we just call it
> > "templates" and not "tmpls"? - Dave
>


-- 
http://raibledesigns.com

Re: svn commit: r508630 - in /incubator/roller/trunk: ./ apps/planet/ apps/planet/src/sql/ metadata/database/ metadata/database/tmpls/

Posted by Allen Gilliland <al...@sun.com>.
yes, templates would have been better, I guess I was just being really 
lazy for some reason :/

part of it was that i didn't care that much about the name because I 
expect that directory to be moved once we migrate the weblogger code to 
the correct place in the new blueprints workspace layout.  so like the 
planet app, the weblogger code will go under /apps/weblogger and the sql 
script templates will be in /apps/weblogger/src/sql/, so it was really 
just chosen as a temporary name until that happens.

i can rename it to "templates" though, since that is a better name.

-- Allen


Dave wrote:
> On 2/16/07, agilliland@apache.org <ag...@apache.org> wrote:
>> Author: agilliland
>> Date: Fri Feb 16 14:40:45 2007
>> New Revision: 508630
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=508630
>> Log:
>> fixing up Roller dbscript generation process to allow for independent 
>> db script generation for Planet and Weblogger apps.  Each application 
>> can now maintain and generate it's own db scripts indpendently of the 
>> other app.
>>
>> NOTE: this doesn't solve the issue of how to properly include the 
>> planet scripts with the weblogger scripts, that will be tackled in a 
>> subsequent commit.
>>
>> Added:
>>     incubator/roller/trunk/apps/planet/src/sql/
>>     incubator/roller/trunk/apps/planet/src/sql/control.vm
>>     incubator/roller/trunk/apps/planet/src/sql/createdb.vm
>>     incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties
>>     incubator/roller/trunk/apps/planet/src/sql/droptables.sql
>>     incubator/roller/trunk/metadata/database/dbscripts.properties
>>     incubator/roller/trunk/metadata/database/macros.vm
>>     incubator/roller/trunk/metadata/database/tmpls/
> 
> No object to the re-org and cleanup, but can't we just call it
> "templates" and not "tmpls"? - Dave

Re: svn commit: r508630 - in /incubator/roller/trunk: ./ apps/planet/ apps/planet/src/sql/ metadata/database/ metadata/database/tmpls/

Posted by Dave <sn...@gmail.com>.
On 2/16/07, agilliland@apache.org <ag...@apache.org> wrote:
> Author: agilliland
> Date: Fri Feb 16 14:40:45 2007
> New Revision: 508630
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=508630
> Log:
> fixing up Roller dbscript generation process to allow for independent db script generation for Planet and Weblogger apps.  Each application can now maintain and generate it's own db scripts indpendently of the other app.
>
> NOTE: this doesn't solve the issue of how to properly include the planet scripts with the weblogger scripts, that will be tackled in a subsequent commit.
>
> Added:
>     incubator/roller/trunk/apps/planet/src/sql/
>     incubator/roller/trunk/apps/planet/src/sql/control.vm
>     incubator/roller/trunk/apps/planet/src/sql/createdb.vm
>     incubator/roller/trunk/apps/planet/src/sql/dbscripts.properties
>     incubator/roller/trunk/apps/planet/src/sql/droptables.sql
>     incubator/roller/trunk/metadata/database/dbscripts.properties
>     incubator/roller/trunk/metadata/database/macros.vm
>     incubator/roller/trunk/metadata/database/tmpls/

No object to the re-org and cleanup, but can't we just call it
"templates" and not "tmpls"? - Dave