<#list tableList as table>
    CREATE TABLE "${table.tableName}"(
    <#list table.columns as column>
        <#if column.isIncrement==1 >
            <#assign autoInc>IDENTITY(1, 1)</#assign>
        <#else>
            <#assign autoInc></#assign>
        </#if>
        <#if column.isRequired==1 >
            <#assign Required>NOT NULL</#assign>
        <#else>
            <#assign Required></#assign>
        </#if>
        <#if column.isPrimaryKey==1 >
            <#assign Required>NOT NULL</#assign>
        </#if>
        <#if column.isRequired==1 >
            <#assign Required>NOT NULL</#assign>
        <#else>
            <#assign Required></#assign>
        </#if>
        <#if column.columnType?contains("bigint") >
            <#assign columnType>bigint</#assign>
        <#elseif column.columnType?contains("tinyint") >
            <#assign columnType>tinyint</#assign>
        <#elseif column.columnType=="int" >
            <#assign columnType>int</#assign>
        <#elseif column.columnType=="datetime" >
            <#assign columnType>timestamp(0)</#assign>
        <#elseif column.columnType=="mediumtext" >
            <#assign columnType>text</#assign>
        <#elseif column.columnType=="longtext" >
            <#assign columnType>text</#assign>
        </#if>

        <#if column.defaultValue??&& column.defaultValue!="">
            <#assign Default>DEFAULT ${column.defaultValue}</#assign>
        <#else>
            <#assign Default></#assign>
        </#if>
        "${column.columnName}" ${columnType}   ${autoInc} ${Required} ${Default} ,
    </#list>
NOT CLUSTER PRIMARY KEY("${table.pkColumn.columnName}"));
COMMENT ON TABLE "${table.tableName}" IS '${table.functionName}';
    <#list table.columns as column>
COMMENT ON COLUMN "${table.tableName}"."${column.columnName}" IS '${column.columnComment}';
    </#list>

</#list>