Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff constantly adding addDefaultValue for a timestamp column #485

Open
rndmrsh opened this issue Apr 26, 2023 · 0 comments
Open

Diff constantly adding addDefaultValue for a timestamp column #485

rndmrsh opened this issue Apr 26, 2023 · 0 comments

Comments

@rndmrsh
Copy link

rndmrsh commented Apr 26, 2023

Hi,

Running Liquibase:diff for a timestamp column with a default value, Liquibase keeps adding addDefaultValue even if the default value is already set in the table.

Versions:
liquibase-core: 4.21.1
liquibase-hibernate5: 4.21.1
spring boot: 2.7.5
org.postgresql:postgresql: 42.3.7
java: 11

liquibase.properties:

referenceDriver=liquibase.ext.hibernate.database.connection.HibernateDriver
referenceUrl=hibernate:spring:com.example\
  ?dialect=org.hibernate.dialect.PostgreSQLDialect\
  &hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy\
  &hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy

Example entity:

@Entity
@Table(name = "test_table")
public class TestEntity {
	@Id
	private Long id;
	@Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
	private LocalDateTime timestamp;
}

Initial changelog to create this table:

<changeSet author="rndmrsh (generated)" id="1682492668200-1">
    <createTable tableName="test_table">
        <column name="id" type="BIGINT">
            <constraints nullable="false" primaryKey="true" primaryKeyName="test_tablePK"/>
        </column>
        <column defaultValueComputed="CURRENT_TIMESTAMP" name="timestamp" type="TIMESTAMP WITHOUT TIME ZONE"/>
    </createTable>
</changeSet>

Subsequent changelogs:

<changeSet author="rndmrsh (generated)" id="1682492714416-1">
    <addDefaultValue columnDataType="timestamp" columnName="timestamp" defaultValueComputed="CURRENT_TIMESTAMP" tableName="test_table"/>
</changeSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants