SQLCreate.ftl 727 Bytes
Newer Older
Paff's avatar
Paff committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<#if op.callCalculator("demo.Constants")></#if>
<#if op.callCalculator("demo.TransformAssociations")></#if>
<#list ast.getCDClasses() as class>
create table ${class.getName()} (
    <#if op.callCalculator("demo.Association", class) >
    autoID INT NOT NULL PRIMARY KEY, 
    </#if>
	<#list class.getCDAttributes() as attr>
	${attr.printName()} ${op.getValue("constants").getType(attr.printType())}<#if attr_has_next>,</#if>
	</#list>
);
<#if op.callCalculator("demo.N2NAssociation", class)>

create table ${class.getName()}_${op.getValue("otherClass")} (
    ${class.getName()} INT NOT NULL,
    ${op.getValue("otherClass")} INT NOT NULL,
     PRIMARY KEY (${class.getName()}, ${op.getValue("otherClass")})
);
</#if>

</#list>