Mysql liquibase未创建无符号列
我的环境:Mysql liquibase未创建无符号列,mysql,liquibase,Mysql,Liquibase,我的环境: java:1.8.0_20,64位 液化酶:3.3.1 mysql:5.5.34 mysql连接器:mysql-connector-java-5.1.34-bin.jar mysql驱动程序:com.mysql.jdbc.driver mysql连接字符串:jdbc:mysql://localhost/my_db mysql用户:根用户 操作系统:windows 7 64 数据库更改日志xml <?xml version="1.0" encoding="UTF-8" sta
- java:1.8.0_20,64位
- 液化酶:3.3.1
- mysql:5.5.34
- mysql连接器:mysql-connector-java-5.1.34-bin.jar
- mysql驱动程序:com.mysql.jdbc.driver
- mysql连接字符串:jdbc:mysql://localhost/my_db
- mysql用户:根用户
- 操作系统:windows 7 64
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd">
<changeSet author="jbenton" id="create my_test_tbl table">
<sql> SET storage_engine=MYISAM; </sql>
<createTable tableName="my_test_tbl">
<column autoIncrement="true" name="my_test_tbl_id" type="INT UNSIGNED">
<constraints primaryKey="true"/>
</column>
<column defaultValueNumeric="0" name="col_smallint" type="SMALLINT">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="0" name="col_smallint_unsigned" type="SMALLINT UNSIGNED"/>
<column defaultValueNumeric="0" name="col_smallint_unsigned_not_null" type="SMALLINT UNSIGNED">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>
我的目标是将列设置为
SMALLINT UNSIGNED
。有什么我做错了吗?我也有同样的问题。这似乎是当前liquibase实现中的一个bug,它似乎在3.4.0(参见)中得到了修复。我试图在3.3.2上实现附加到问题()的提交。这解决了无符号问题,但创建自动递增无符号类型的列失败
最后,我使用了3.0.7版,这似乎是最后一个没有这个问题的版本。到目前为止,它工作得完美无缺 我实现了修复此问题的方法。它已合并到主分支。如果您可以使用基于master的快照版本,那么您可以在3.4.0发布之前获得修复,我怀疑这将在未来几个月内实现
如果您使用的是Maven:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.4.0-SNAPSHOT</version>
</dependency>
然后更新您的POM:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.3.4-SNAPSHOT</version>
</dependency>
org.liquibase
液化酶核心
3.3.4-快照
或者使用生成的发行版zip文件。对不起,我看不出这里有什么问题。查看源代码,我可以看到注释
/始终是smallint,而不管在类上传递的参数是什么。我不监督整个代码,因此无法确定这是否真的表明该类型的其他参数(如“unsigned”)被遗漏了。也许你可以为此在liquibase github上提交一个bug/增强?我会提交一个bug。我只是想确定没有什么明显的遗漏。我在stackoverflow上看到了几个例子,在这些例子中,它似乎对其他人起到了作用。请注意,id是一个我定义为“int unsigned”的int,它最终是一个普通的旧int。在3.3.2版type=“BIGINT unsigned”
中,即使如此,它也只是创建了BIGINT(20)
not unsigned一些人说unsigned不是SQL标准。因此,液化酶可能不会得到支持。
$ git clone https://github.com/liquibase/liquibase.git
$ cd liquibase
$ git checkout 3.3.x
$ git cherry-pick 5bf8fc591477587c3f61c876e91011d0b8a6d362
$ git status
$ # resolve the merge conflicts
$ vi liquibase-core/src/main/java/liquibase/datatype/core/*IntType.java
$ git add '*.java'
$ git cherry-pick --continue
$ mvn clean verify
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.3.4-SNAPSHOT</version>
</dependency>