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"]) #** Special macro to add table column with default null **# #macro(addColumnNull $table $column $type) alter table $table add column $column $type default null; #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 #** Loop through templates, generate database scripts **# #foreach ($template in $templates) #set($in = "${template}.vm") #set($out = "${template}.sql") $generator.parse($in, $out) #end