今天排查一個bug發現開發環境老是報錯 order_num 字段insert的時候不能為空,但是發現測試環境沒有這個問題。
后來發現測試環境有一個數據庫docker安裝的mysql 版本是5.7 而開發環境是5.7.24 懷疑是這個問題引起的。
后來測試了一下果然,在5.7中執行如下語句只會warning並且把order_num寫入0 但是5.7.24會直接報錯
create table t_instance_struct_2
(
struct_id varchar(36) not null,
task_code varchar(30),
order_num decimal(10,0) not null,
primary key (struct_id)
);
insert into t_instance_struct_2 values ('1','aa',null),('2','aa2',null);