willbryant / kitchen_sync

Fast unidirectional synchronization - make or efficiently update a copy of a database, without slow dumping & reloading
MIT License
282 stars 35 forks source link

Can't sync tinyint(1) with data 4 #97

Closed eeokee closed 3 years ago

eeokee commented 3 years ago

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

willbryant commented 3 years ago

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.
eeokee commented 3 years ago

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.

willbryant commented 3 years ago

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.

eeokee commented 3 years ago

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