我尝试通过liquibase变更集创建一个新表,如下所示:
<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>
此操作失败并出现以下错误:
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'
如果我设置autoIncrement =“false”,这很有效。
这是一个已知的问题吗?
修改
这是有效的:
<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"/>
答案 0 :(得分:9)
更改类型= “数字”以输入= “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>
希望它有效.. !!!!