Alien
Alien

Reputation: 426

Liquibase always generating changesets for creating/dropping index

I am just starting to use Liquibase and I am wondering: why is it that when I run ./mvnw compile liquibase:diff are change sets generated to first drop existing indexes and then recreate them if they already exist?

Ex:

 <changeSet author="me (generated)" id="1486157347995-13">
      <dropIndex indexName="my_idx" tableName="notification"/>
      <createIndex indexName="my_idx" tableName="notification">
         <column name="index_col"/>
      </createIndex>
</changeSet>

Upvotes: 3

Views: 1318

Answers (1)

Fabien Benoit-Koch
Fabien Benoit-Koch

Reputation: 2841

Probably out of "laziness".

This is a simple way to make sure the index created is the same (not only the name, but the columns used) than the one in the reference database.

It handles two diff cases in one:

  • missing index name in the target db,
  • same index name but with a different definition.

Upvotes: 2

Related Questions