Java – liquibase inserts bit column, mysql, column with too long data
•
Java
In liquibase, I define a table with a column of type 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>
In the subsequent change set, I want to insert data into this table, but when inserting data into the "activity" column of bit (1), MySQL will complain about "data truncation: data too long for column"
I tried:
<insert> <column name="active" value="1" type="BIT(1)" /> </insert>
and
<insert> <column name="active" value="1"/> </insert>
and
<insert> <column name="active" value="TRUE" type="BOOLEAN"/> </insert>
What is the correct way to insert the bit (1) column?
Solution
Answer my own questions because I posted this To insert into the bit (1) column, you need to define the value as valueboolean
<insert> <column name="active" valueBoolean="true"/> </insert>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码