我的环境:liquibase不产生无符号列
- 的java:1.8.0_20,64位
- liquibase:3.3.1
- MySQL的:34年5月5日
- MySQL的连接器:mysql-连接器的Java-5.1.34-bin.jar
- MySQL驱动:com.mysql.jdbc.Driver
- MySQL连接字符串:JDBC:MySQL的://本地主机/ MY_DB
- MySQL用户:根用户
- 操作系统:Windows 7 64
数据库更改日志XML
<?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>
使用updateSql
命令,我看到以下SQL产生
CREATE TABLE my_db.my_test_tbl (
my_test_tbl_id INT AUTO_INCREMENT NOT NULL,
col_smallint SMALLINT DEFAULT 0 NOT NULL,
col_smallint_unsigned SMALLINT DEFAULT 0 NULL,
col_smallint_unsigned_not_null SMALLINT DEFAULT 0 NOT NULL,
CONSTRAINT PK_MY_TEST_TBL PRIMARY KEY (my_test_tbl_id));
我的目标是列将是SMALLINT UNSIGNED
。有什么我做错了吗?
对不起,我真的不明白这里有什么可能是错的。查看源代码,我可以在['SmallIntType.java'](https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/)上看到一个注释'/ always smallint, main/java/liquibase/datatype/core/SmallIntType.java)类。我不监督整个代码,因此不能肯定地说这是否真的表明该类型的其他参数(如“unsigned”)被省略。也许你可以在liquibase-github上提交一个bug /增强? – Jens
我会提交一个错误。我只是想确保没有什么明显的我错过了。我已经看到了几个似乎已经为其他人工作的stackoverflow的例子。请注意,该id是一个int,我将其定义为'int unsigned',并以普通的旧int结尾。在3.3.2版本中,类型为“BIGINT UNSIGNED”的类型为' –
',即使对于其也创建了'BIGINT(20)'未unsigned –