jp.co.tis.gsp.tools.db.template.postgresql.createIndex.ftl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gsp-dba-maven-plugin Show documentation
Show all versions of gsp-dba-maven-plugin Show documentation
To automate the routine work of the DBA, it is a tool to be able to concentrate on the data modeling work.
<#-- postgresqlではindexは常に指定テーブルと同じスキーマに作成されるためスキーマ修飾はなし -->
<#if index.isPrimaryKey()>
ALTER TABLE <#if entity.schema?has_content>${entity.schema}.#if>${entity.name} ADD CONSTRAINT ${index.name!} PRIMARY KEY
<#elseif index.type=1>
ALTER TABLE <#if entity.schema?has_content>${entity.schema}.#if>${entity.name} ADD CONSTRAINT ${index.name!} UNIQUE
<#elseif index.type=2 || index.type=3>
CREATE <#if index.type=2>UNIQUE #if>INDEX ${index.name} ON <#if entity.schema?has_content>${entity.schema}.#if>${entity.name}
#if>
(
<#foreach column in index.columnList>
${column.name}<#if column_has_next>,#if>
#foreach>
);