Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Diff primary key index creation loop (spring boot + Hibernate 5)

$
0
0

When I generate the first diff. The diff file looks correct. It has the tables that we need to create. I run the app, it creates the tables (Oracle), all is good. For validation purposes I run the diff command again, expecting for it to return with no changes. Unfortunately it comes back with changes to the Primary Key Column. If I run the new set of changes and do another diff. It still comes back with the same change logs. It will do this infinitely.

I think that I might be using the wrong decencies but I am very lost.

POM

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.2.1.RELEASE</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
   <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
   </dependency>
   <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
   </dependency>
   <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <optional>true</optional>
   </dependency>
   <dependency>
      <groupId>com.oracle.database</groupId>
      <artifactId>ojdbc7</artifactId>
      <version>12.1.0.1</version>
   </dependency>
   <dependency>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-core</artifactId>
   </dependency>
</dependencies>
...
<plugin>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
        <propertyFile>/src/main/resources/liquibase.properties</propertyFile>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-hibernate5</artifactId>
            <version>3.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>2.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
    </dependencies>
</plugin>

Diff that is always created

databaseChangeLog:
- changeSet:
    id: 1578435590163-1
    author: Stackoverflow (generated)
    changes:
    - dropPrimaryKey:
        tableName: users
- changeSet:
    id: 1578435590163-2
    author: Stackoverflow (generated)
    changes:
    - createIndex:
        columns:
        - column:
            name: username
        indexName: IX_usersPK
        tableName: users
        unique: true
- changeSet:
    id: 1578435590163-3
    author: Stackoverflow (generated)
    changes:
    - addPrimaryKey:
        columnNames: username
        constraintName: usersPK
        forIndexName: IX_usersPK
        tableName: users

liquibase properties

referenceUrl=hibernate:spring:com.example?dialect=org.hibernate.dialect.Oracle12cDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy


Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>