在Liquibase中,我定义一个具有BIT(1)类型的列的表,
<changeSet author="foobar" id="create-configuration-table"> <createTable tableName="configuration"> <column autoIncrement="true" name="id" type="BIGINT(19)"> <constraints primaryKey="true" /> </column> <column name="active" type="BIT(1)" /> <column name="version" type="INT(10)" /> </createTable> </changeSet>
在随后的变更集中,我想将数据插入到此表中,但是,当将数据插入到BIT(1)类型的“活动”列中时,MysqL会抱怨“Data truncation:Data too long for column”
我努力了:
<insert> <column name="active" value="1" type="BIT(1)" /> </insert>
和
<insert> <column name="active" value="1"/> </insert>
和
<insert> <column name="active" value="TRUE" type="BOOLEAN"/> </insert>
插入BIT(1)列的正确方法是什么?
解决方法
回答我自己的问题,因为我发布了这个.要插入到BIT(1)列中,您需要将值定义为valueBoolean
<insert> <column name="active" valueBoolean="true"/> </insert>
原文地址:https://www.jb51.cc/java/124398.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。