Skip to content

Conversation

@filipelautert filipelautert marked this pull request as ready for review July 11, 2024 23:12
@StevenMassaro
Copy link
Contributor

Are there any tests which cover these changes? If not, can one or some be added?

@filipelautert filipelautert merged commit e77dcf9 into master Aug 5, 2024
38 checks passed
@filipelautert filipelautert deleted the DAT-17993 branch August 5, 2024 13:27
filipelautert added a commit that referenced this pull request Aug 13, 2024
* fix: integers don't have size on mssql

* fix: Internally Oracle converts int/integer to number, so when we need to extract and compare it we need number too.

* feat: add column name correction + some code reuse

* chore: handle nullpointer

* fix: as only oracle supports PK validate, we will use it only for Oracle vs Oracle comparisons

* chore: refactoring to use constants

* chore: include files in internal/lib folder

---------

Co-authored-by: filipe <flautert@liquibase.com>
Co-authored-by: obovsunivskyii <baqaua@gmail.com>
@mmelnik
Copy link

mmelnik commented Jun 3, 2025

@filipelautert Hi, Filipe,

I've recently switched to liquibase-core 4.29.2 from 4.27.0 in my project and found that Oracle diff calculation is broken because of changes in this pull reuqest, especially because of this implementation of OracleDatabase.correctObjectName():

@Override
public String correctObjectName(String objectName, Class<? extends DatabaseObject> objectType) {
    // Internally Oracle converts int/integer to number, so when we need to extract and compare it we need number too
    if (objectType.equals(Column.class) && StringUtils.startsWithIgnoreCase(objectName, "int")) {
        return "NUMBER(*, 0)";
    }
    return super.correctObjectName(objectName, objectType);
}

This method automatically converts all column names that starts from int*, like "internalPhoneNumber" to "NUMBER(*, 0)" and brakes Metadata comparison so diff generation is incorrect.

Exact thing is StringUtils.startsWithIgnoreCase(objectName, "int") - I confused a little bit why we're unconditionally change objectName which can be the column name itself and not the COLUMN TYPE name?

I might be wrong, but this looks like bug to me. Could you or someone from the team help me to clarify that, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants