2 <#list tableList as table>
\r
3 <#list table.foreignKeyList as fk>ALTER TABLE ${table.name} DROP CONSTRAINT ${fk.name}
\r
7 <#list tableList as table>
\r
8 DROP TABLE ${table.name};
\r
12 <#list tableList as table>
\r
13 CREATE TABLE ${table.name} (
\r
14 <#list table.columnList as column> ${column.name} ${column.definition}<#if column_has_next>,</#if>
\r
18 <#if table.primaryKey??>ALTER TABLE ${table.name} ADD CONSTRAINT ${table.primaryKey.name}
\r
19 PRIMARY KEY (<#list table.primaryKey.columnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r
22 <#list table.uniqueList as unique>ALTER TABLE ${table.name} ADD CONSTRAINT ${unique.name}
\r
23 UNIQUE (<#list unique.columnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r
26 <#if table.alias?? || table.note??>
\r
27 COMMENT ON TABLE ${table.name} IS '<#if table.alias??>${table.alias}:</#if><#if table.note??>${table.note}</#if>'
\r
30 <#list table.columnList as column>
\r
31 <#if column.alias?? || column.note??>
\r
32 COMMENT ON COLUMN ${table.name}.${column.name} IS '<#if column.alias??>${column.alias}:</#if><#if column.note??>${column.note}</#if>'
\r
39 <#list tableList as table>
\r
40 <#list table.foreignKeyList as fk>ALTER TABLE ${table.name} ADD CONSTRAINT ${fk.name}
\r
41 FOREIGN KEY (<#list fk.columnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r
42 REFERENCES ${fk.targetTable} (<#list fk.targetColumnNameList as columnName>${columnName}<#if columnName_has_next>,</#if></#list>)
\r