willbryant/kitchen_sync

Can't sync tinyint(1) with data 4

eeokee opened this issue · 4 comments

I sync mysql to mysql, got this error

Output:

Kitchen Sync
Error in the 'from' worker: Invalid value for boolean column client_pay_detail.pay_way: 4 (we assume tinyint(1) is used for booleans)
Error in the 'to' worker: Connection closed
Kitchen Syncing failed.

Expect:
support sync tinyint(1) with data not only booleans

I guess I expected someone would run into this sooner or later.

But, please note that MySQL has deprecated using display widths, and they assume tinyint(1) is for boolean too - see https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html

Display width specification for integer data types was deprecated in MySQL 8.0.17, and now statements that include data type definitions in their output no longer show the display width for integer types, with these exceptions:

  • The type is TINYINT(1). MySQL Connectors make the assumption that TINYINT(1) columns originated as BOOLEAN columns; this exception enables them to continue to make that assumption.

This project is old, use mysql version 5.7.27, I don't want to change project code.
Thanks for your response, I will try another tool.

OK, I will commit a partial workaround that will get it working for this particular case, it will help some users but will not work for others.

Hi @willbryant, I try your new changed, it works well.
Thanks a lot.