Mad Scientist
Mad Scientist

Reputation: 917

Add NONCLUSTERED statement in liquibase changelog

I have a changelog file which was generated by liquibase and now I want to customize the changelog. The following changelog:

 </changeSet>
<changeSet author="Silver (generated)" id="1528876614155-112">
    <createIndex indexName="DTDT_PK" tableName="DATE_DATA_TYPE" unique="true">
        <column name="TYPE_ID"/>
    </createIndex>
    <addPrimaryKey columnNames="TYPE_ID" constraintName="DTDT_PK"  tableName="DATE_DATA_TYPE"/>
</changeSet>

generates this SQL statement:

CREATE UNIQUE NONCLUSTERED INDEX DTDT_PK ON [DATE_DATA_TYPE]([TYPE_ID])
GO

ALTER TABLE [DATE_DATA_TYPE] ADD CONSTRAINT [DTDT_PK] PRIMARY KEY ([TYPE_ID])
GO

but I want to generate a SQL statement like this:

ALTER TABLE [DATE_DATA_TYPE] ADD CONSTRAINT [DTDT_PK] PRIMARY KEY NONCLUSTERED ([TYPE_ID])
GO

How can I add a NONCLUSTERED to it?

Upvotes: 1

Views: 1235

Answers (1)

Mad Scientist
Mad Scientist

Reputation: 917

I found the solution. I just had to add a clustered="false" attribute.

 </changeSet>
<changeSet author="Silver (generated)" id="1528876614155-112">
   <addPrimaryKey columnNames="TYPE_ID" constraintName="DTDT_PK"
tableName="DATE_DATA_TYPE" clustered="false"/>
</changeSet>

Upvotes: 1

Related Questions