You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/12/21 15:46:29 UTC
svn commit: r358301 - /incubator/roller/trunk/metadata/database/
Author: snoopdave
Date: Wed Dec 21 06:46:23 2005
New Revision: 358301
URL: http://svn.apache.org/viewcvs?rev=358301&view=rev
Log:
We now have a properties file for each database (again), a master control template and the addColumn() macro is defined centrallly.
Added:
incubator/roller/trunk/metadata/database/control.vm
incubator/roller/trunk/metadata/database/db2.properties
incubator/roller/trunk/metadata/database/derby.properties
incubator/roller/trunk/metadata/database/hsqldb.properties
incubator/roller/trunk/metadata/database/mysql.properties
incubator/roller/trunk/metadata/database/oracle.properties
incubator/roller/trunk/metadata/database/postgresql.properties
Removed:
incubator/roller/trunk/metadata/database/control-db2.vm
incubator/roller/trunk/metadata/database/control-derby.vm
incubator/roller/trunk/metadata/database/control-hsql.vm
incubator/roller/trunk/metadata/database/control-mysql.vm
incubator/roller/trunk/metadata/database/control-oracle.vm
incubator/roller/trunk/metadata/database/control-postgresql.vm
Modified:
incubator/roller/trunk/metadata/database/200-to-210-migration.vm
incubator/roller/trunk/metadata/database/createdb.vm
Modified: incubator/roller/trunk/metadata/database/200-to-210-migration.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/200-to-210-migration.vm?rev=358301&r1=358300&r2=358301&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/200-to-210-migration.vm (original)
+++ incubator/roller/trunk/metadata/database/200-to-210-migration.vm Wed Dec 21 06:46:23 2005
@@ -1,20 +1,8 @@
+#**
+200-to-210-migration.vm: Velocity template that generates vendor-specific database scripts
-#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 $column $type default $default not null;
-#end
-#end
+DON'T RUN THIS, IT'S NOT A DATABASE CREATION SCRIPT!!!
+**#
-- Add to roller_comment table: approved and pending fields
Added: incubator/roller/trunk/metadata/database/control.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/control.vm?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/control.vm (added)
+++ incubator/roller/trunk/metadata/database/control.vm Wed Dec 21 06:46:23 2005
@@ -0,0 +1,37 @@
+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"])
+
+#** Define special macro needed for alter table with not-null restriction **#
+#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 $column $type default $default not null;
+#end
+#end
+
+#** Loop through templates, generate database scripts **#
+#foreach ($template in $templates)
+ #set($in = "${template}.vm")
+ #set($out = "${template}.sql")
+ $generator.parse($in, $out)
+#end
+
+
+
+
Modified: incubator/roller/trunk/metadata/database/createdb.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/createdb.vm?rev=358301&r1=358300&r2=358301&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/createdb.vm (original)
+++ incubator/roller/trunk/metadata/database/createdb.vm Wed Dec 21 06:46:23 2005
@@ -1,15 +1,10 @@
+#**
+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 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 Oracle run the script createdb.sql found in the oracle 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
@@ -418,6 +413,7 @@
updated timestamp
);
create index rage_sid_idx on rag_entry(subscription_id$INDEXSIZE);
+
-- *****************************************************
-- Now add the foreign key relationships
Added: incubator/roller/trunk/metadata/database/db2.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/db2.properties?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/db2.properties (added)
+++ incubator/roller/trunk/metadata/database/db2.properties Wed Dec 21 06:46:23 2005
@@ -0,0 +1,11 @@
+DBTYPE=DB2
+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=
+ADDL_FK_PARAMS=on delete no action on update no action enforced enable query optimization
+TIMESTAMP_SQL_TYPE_NULL=timestamp null
Added: incubator/roller/trunk/metadata/database/derby.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/derby.properties?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/derby.properties (added)
+++ incubator/roller/trunk/metadata/database/derby.properties Wed Dec 21 06:46:23 2005
@@ -0,0 +1,13 @@
+DBTYPE=DERBY
+BOOLEAN_SQL_TYPE_TRUE=smallint default 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=
+ADDL_FK_PARAMS=
+TIMESTAMP_SQL_TYPE_NULL=timestamp
+
Added: incubator/roller/trunk/metadata/database/hsqldb.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/hsqldb.properties?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/hsqldb.properties (added)
+++ incubator/roller/trunk/metadata/database/hsqldb.properties Wed Dec 21 06:46:23 2005
@@ -0,0 +1,12 @@
+DBTYPE=HSQLDB
+BOOLEAN_SQL_TYPE_TRUE=bit 1
+TEXT_SQL_TYPE=longvarchar
+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=
+INDEXSIZE_LARGE=
+ADDL_FK_PARAMS=
+TIMESTAMP_SQL_TYPE_NULL=timestamp null
Added: incubator/roller/trunk/metadata/database/mysql.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/mysql.properties?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/mysql.properties (added)
+++ incubator/roller/trunk/metadata/database/mysql.properties Wed Dec 21 06:46:23 2005
@@ -0,0 +1,12 @@
+DBTYPE=MYSQL
+BOOLEAN_SQL_TYPE_TRUE=bit 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)
+ADDL_FK_PARAMS=
+TIMESTAMP_SQL_TYPE_NULL=datetime NULL
Added: incubator/roller/trunk/metadata/database/oracle.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/oracle.properties?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/oracle.properties (added)
+++ incubator/roller/trunk/metadata/database/oracle.properties Wed Dec 21 06:46:23 2005
@@ -0,0 +1,12 @@
+DBTYPE=ORACLE
+BOOLEAN_SQL_TYPE_TRUE=number(1)
+TEXT_SQL_TYPE=text
+BOOLEAN_SQL_TYPE_FALSE=number(1) default 0
+BOOLEAN_SQL_TYPE_TRUE=number(1) default 1
+BOOLEAN_SQL_TYPE=bit
+BOOLEAN_FALSE=0
+BOOLEAN_TRUE=1
+INDEXSIZE=
+INDEXSIZE_LARGE=
+ADDL_FK_PARAMS=
+TIMESTAMP_SQL_TYPE_NULL=timestamp null
Added: incubator/roller/trunk/metadata/database/postgresql.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/postgresql.properties?rev=358301&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/postgresql.properties (added)
+++ incubator/roller/trunk/metadata/database/postgresql.properties Wed Dec 21 06:46:23 2005
@@ -0,0 +1,11 @@
+DBTYPE=POSTGRESQL
+TEXT_SQL_TYPE=text
+BOOLEAN_SQL_TYPE_FALSE=boolean default false
+BOOLEAN_SQL_TYPE_TRUE=boolean default true
+BOOLEAN_SQL_TYPE=boolean
+BOOLEAN_FALSE=false
+BOOLEAN_TRUE=true
+INDEXSIZE=
+INDEXSIZE_LARGE=
+ADDL_FK_PARAMS=
+TIMESTAMP_SQL_TYPE_NULL=timestamp null