# ---------------------------------------------------- #foreach($table in $droptables) DROP TABLE IF EXISTS $table.name; #end # ---------------------------------------------------- #foreach($table in $tables) CREATE TABLE $table.name ( #set( $dec = '' ) #foreach($col in $table.columns) #notnull($nullString $col) #if( $col.type=="TEXT" || $col.type=="MEDIUMTEXT" || $col.type=="LONGTEXT" ) #set($size='') #else #set($size="$col.printSize()") #end #set( $dec = "$dec $col.name $col.type$size $nullString,$eol" ) #end #if( $table.primaryKey ) #set($cols = '') #foreach($col in $table.primaryKey.columns) #if( $col.size > 255 ) #set ( $csize = "(255)" ) #else #set ( $csize = '' ) #end #set($cols = "$cols $col.name$csize,") #end #set( $dec = "$dec PRIMARY KEY ($strings.chop($cols,1) ),$eol" ) #end #foreach($fk in $table.foreignKeys) #set($dec = "$dec FOREIGN KEY ($fk.localKey) REFERENCES $fk.foreignTable ($fk.foreignKey),$eol" ) #end #foreach($index in $table.indices) #set($cols = '') #foreach($col in $index.columns) #if( $col.size > 255 ) #set ( $csize = "(255)" ) #else #set ( $csize = '' ) #end #set($cols = "$cols $col.name$csize,") #end #set( $dec = "$dec UNIQUE ($strings.chop($cols,1) ),$eol" ) #end #set( $dec = $strings.chop($dec,1) ) $dec ) TYPE=InnoDB; #end