---------------------------------------------------- #foreach($table in $droptables) DROP TABLE $table.name; #end ---------------------------------------------------- #foreach($table in $tables) CREATE TABLE $table.name ( #set( $dec = '' ) #foreach($col in $table.columns) #notnull($nullString $col) #if($col.name == "NAME" ) #set($colname = '"NAME"') #else #set($colname = "$col.name") #end #set( $dec = "$dec $colname $col.type$col.printSize() $nullString,$eol" ) #end #if( $table.primaryKey ) #printcols_db2($cols $table.primaryKey.columns) #set( $dec = "$dec CONSTRAINT ${dquot}P_KEY_1$dquot PRIMARY KEY ($cols ),$eol" ) #end #foreach($index in $table.indices) #if($index.unique) #printcols($cols $index.columns) #set( $dec = "$dec CONSTRAINT ${dquot}A_KEY_$velocityCount$dquot UNIQUE ($cols ),$eol" ) #end #end #set( $dec = $strings.chop($dec,1) ) $dec ); #end #foreach($table in $tables) #foreach($fk in $table.foreignKeys) ALTER TABLE ${table.name} ADD CONSTRAINT "${table.name}_FK_${velocityCount}" FOREIGN KEY ($fk.localKey) REFERENCES $fk.foreignTable ($fk.foreignKey) ON DELETE RESTRICT ON UPDATE RESTRICT; #end #end