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

Double unsigned cannot be created in MySQL. #2169

Closed
ThisOldDog opened this issue Nov 1, 2021 · 3 comments · Fixed by #2293
Closed

Double unsigned cannot be created in MySQL. #2169

ThisOldDog opened this issue Nov 1, 2021 · 3 comments · Fixed by #2293

Comments

@ThisOldDog
Copy link

ThisOldDog commented Nov 1, 2021

Environment

Liquibase Version: 4.5.0

Liquibase Integration & Version: maven

<dependency>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-core</artifactId>
  <version>4.5.0</version>
</dependency>

Description

Double unsigned cannot be created in MySQL, unsigned additional information is lost.

Steps To Reproduce

Create a table in ChangeSet, specify the column type as double(32,0) unsigned: liquibase.datatype.core.DoubleType
image

Actual Behavior

As you can see, the Double type DatabaseDataType is created, but additionalInformation = unsigned is lost (Is this a bug?).

Expected/Desired Behavior

additionalInformation can be added to DatabaseDataType, such as (The example only fixes MySQL):

if (database instanceof MySQLDatabase) {
    DatabaseDataType databaseDataType;
    if ((getParameters() != null) && (getParameters().length > 1)) {
        databaseDataType =  new DatabaseDataType("DOUBLE", getParameters());
    } else {
        databaseDataType = new DatabaseDataType("DOUBLE");
    }
    databaseDataType.addAdditionalInformation(getAdditionalInformation());
    return databaseDataType;
}

Additional Context

Any help would be appreciated 😃.

@molivasdat
Copy link
Contributor

Hi @ThisOldDog Thanks for showing us this issue. Can you also add a changeset that shows the issue that you are describing? We will add this to the list of issues that we are processing.

@ThisOldDog
Copy link
Author

Hi @ThisOldDog Thanks for showing us this issue. Can you also add a changeset that shows the issue that you are describing? We will add this to the list of issues that we are processing.

Thank you for your reply. The test example is as follows:

{
    "databaseChangeLog": [
        {
            "logicalFilePath": "21cec2ff6c90427e9b6d0c27cffcc1fb.custom",
            "changeSet": {
                "changes": [
                    {
                        "createTable": {
                            "columns": [
                                {
                                    "column": {
                                        "name": "DOUBLE_COLUMN",
                                        "type": "double(38,2) unsigned",
                                        "remarks": "double_unsigned"
                                    }
                                },
                                {
                                    "column": {
                                        "name": "ID",
                                        "type": "bigint(19)",
                                        "constraints": {
                                            "primaryKeyName": "test_double_pk"
                                        },
                                        "remarks": "PK"
                                    }
                                }
                            ],
                            "tableName": "test_double"
                        }
                    },
                    {
                        "sql": {
                            "stripComments": false,
                            "splitStatements": false,
                            "sql": " ALTER TABLE test_double MODIFY COLUMN ID BIGINT(19) NOT NULL  COMMENT 'PK' AUTO_INCREMENT "
                        }
                    }
                ],
                "id": "2021-11-17_test_double",
                "author": "12706"
            }
        }
    ]
}

@nvoxland
Copy link
Contributor

Thanks, @ThisOldDog. I used your suggested code in #2293

@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Dec 22, 2021
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Dec 22, 2021
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Dec 25, 2021
@nvoxland nvoxland removed this from Done in Conditioning++ Jan 6, 2022
@nvoxland nvoxland added this to the v4.7.0 milestone Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants