1 <#list tableList as table>
\r
2 DROP TABLE ${table.name};
\r
5 <#list tableList as table>
\r
6 CREATE TABLE ${table.name} (
\r
7 <#list table.columnList as column> ${column.name} ${column.definition}<#if column_has_next>,</#if>
\r
11 <#if table.primaryKey??>ALTER TABLE ${table.name} ADD CONSTRAINT ${table.primaryKey.name}
\r
12 PRIMARY KEY (<#list table.primaryKey.columnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r
15 <#list table.uniqueList as unique>ALTER TABLE ${table.name} ADD CONSTRAINT ${unique.name}
\r
16 UNIQUE (<#list unique.columnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r
19 <#if table.comment??>
\r
20 COMMENT ON TABLE ${table.name} IS '${table.comment}'
\r
23 <#list table.columnList as column>
\r
24 <#if column.comment??>
\r
25 COMMENT ON COLUMN ${table.name}.${column.name} IS '${column.comment}'
\r
32 <#list tableList as table>
\r
33 <#list table.foreignKeyList as fk>ALTER TABLE ${table.name} ADD CONSTRAINT ${fk.name}
\r
34 FOREIGN KEY (<#list fk.columnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r
35 REFERENCES ${fk.targetTable} (<#list fk.targetColumnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r