Liquibase not working with mysql autoincrement

Frederic Close

I try to create a new table via a liquibase changeset that looks like:

    <createTable tableName="mytable">
        <column name="id" type="number" autoIncrement="true">
            <constraints primaryKey="true" nullable="false"/>
        </column>
        <column name="name" type="varchar(50)"/>
        <column name="description" type="varchar(255)"/>
        <column name="image_path" type="varchar(255)"/>
    </createTable>

this fails with following error:

liquibase.exception.DatabaseException: 
Error executing SQL CREATE TABLE 
kkm.mytable (id numeric AUTO_INCREMENT NOT NULL, name VARCHAR(50) NULL, description 
             VARCHAR(255) NULL, image_path VARCHAR(255) NULL, 
             CONSTRAINT PK_BOUFFE PRIMARY KEY (id)): 
Incorrect column specifier for column 'id'

if I set autoIncrement="false", this works perfectly.
Is this a known issue ?

EDIT:

this is working:

    <createTable tableName="mytable">
        <column name="id" type="number" autoIncrement="false">
            <constraints primaryKey="true" nullable="false"/>
        </column>
        <column name="name" type="varchar(50)"/>
        <column name="description" type="varchar(255)"/>
        <column name="image_path" type="varchar(255)"/>
    </createTable>

    <addAutoIncrement
            columnDataType="int"
            columnName="id"
            incrementBy="1"
            startWith="1"
            tableName="mytable"/>
Waheed

Change type="number" to type="BIGINT".

i,e

 <createTable tableName="mytable">
        <column name="id" type="BIGINT" autoIncrement="true">
            <constraints primaryKey="true" nullable="false"/>
        </column>
        <column name="name" type="varchar(50)"/>
        <column name="description" type="varchar(255)"/>
        <column name="image_path" type="varchar(255)"/>
    </createTable>

Hope it works..!!!!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Renaming primary key column via Liquibase, autoincrement is dropped(MySQL)

From Dev

Renaming primary key column via Liquibase, autoincrement is dropped(MySQL)

From Dev

AUTOINCREMENT not working

From Dev

MySQL index out of range with autoincrement

From Dev

Liquibase mysql store newline

From Dev

Liquibase mysql store newline

From Dev

INTEGER PRIMARY KEY AUTOINCREMENT in Android not working

From Dev

webSQL AUTOINCREMENT not working (Different from the one in search)

From Dev

Rollback is not working in oracle using liquibase

From Dev

Elasticsearch not working with data loaded by liquibase

From Dev

Liquibase not working from within JBoss?

From Dev

now() function is not working with valueBlobFile in liquibase

From Dev

AUTOINCREMENT not automatically adding values in Mysql Workbench IDE

From Dev

mysql add an autoincrement column with start value

From Dev

sqlalchemy autoincrement value as foreign key mysql

From Dev

Why mysql insert ignore increase autoincrement field?

From Dev

cakephp mysql ,autoincrement id or varchar as primary key

From Dev

Not able to create MYSQL table due to autoincrement duplicate

From Dev

mysql autoincrement id vs php generated id

From Dev

PHP not inserting autoincrement field in a MySQL temporary table

From Dev

Liquibase updateSQL for mysql with stored routines

From Dev

Liquibase introduction into an existing project and MySQL

From Dev

JHipster Liquibase Warning SSL Mysql

From Dev

Eclipse XML autocomplete in liquibase files stopped working

From Dev

JHipster Maven liquibase:diff goal not working as expected

From Dev

Java Hibernate AutoIncrement Identity set ID to start 0 mySQL

From Dev

MySQL: unexpected SELECT result after INSERT into table with autoincrement column

From Dev

Need help writing this update query with if condition and autoincrement in mysql

From Dev

Mysql with Python can't insert record with autoincrement id, why?

Related Related

  1. 1

    Renaming primary key column via Liquibase, autoincrement is dropped(MySQL)

  2. 2

    Renaming primary key column via Liquibase, autoincrement is dropped(MySQL)

  3. 3

    AUTOINCREMENT not working

  4. 4

    MySQL index out of range with autoincrement

  5. 5

    Liquibase mysql store newline

  6. 6

    Liquibase mysql store newline

  7. 7

    INTEGER PRIMARY KEY AUTOINCREMENT in Android not working

  8. 8

    webSQL AUTOINCREMENT not working (Different from the one in search)

  9. 9

    Rollback is not working in oracle using liquibase

  10. 10

    Elasticsearch not working with data loaded by liquibase

  11. 11

    Liquibase not working from within JBoss?

  12. 12

    now() function is not working with valueBlobFile in liquibase

  13. 13

    AUTOINCREMENT not automatically adding values in Mysql Workbench IDE

  14. 14

    mysql add an autoincrement column with start value

  15. 15

    sqlalchemy autoincrement value as foreign key mysql

  16. 16

    Why mysql insert ignore increase autoincrement field?

  17. 17

    cakephp mysql ,autoincrement id or varchar as primary key

  18. 18

    Not able to create MYSQL table due to autoincrement duplicate

  19. 19

    mysql autoincrement id vs php generated id

  20. 20

    PHP not inserting autoincrement field in a MySQL temporary table

  21. 21

    Liquibase updateSQL for mysql with stored routines

  22. 22

    Liquibase introduction into an existing project and MySQL

  23. 23

    JHipster Liquibase Warning SSL Mysql

  24. 24

    Eclipse XML autocomplete in liquibase files stopped working

  25. 25

    JHipster Maven liquibase:diff goal not working as expected

  26. 26

    Java Hibernate AutoIncrement Identity set ID to start 0 mySQL

  27. 27

    MySQL: unexpected SELECT result after INSERT into table with autoincrement column

  28. 28

    Need help writing this update query with if condition and autoincrement in mysql

  29. 29

    Mysql with Python can't insert record with autoincrement id, why?

HotTag

Archive