我的環境: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 –