taps
taps copied to clipboard
Fixed mysql tinyint length error
Hey Ricardo, can you please check out this fix of mine? I've been experiencing a bug when trying to convert a mysql table that uses tinyint into a sqlite3 database. Recent versions of Sequel convert tinyints into booleans. your code then converts these into the strings "true" or "false", which are too long for the tinyint field length of 1, which causes a length error. This patch tells Sequel not to interpret tinyints as booleans.
Thanks, Carl
You got some sample mysql or sqlite db dump that I can try it with? Also what version of sqlite & mysql gems are you using
Sorry this took so long. Here is a mysql dump that should exercise the problem if you pull it to a sqlite database:
https://gist.github.com/718275
Bump
I'm also getting this issue. Here's the error I get when I run heroku db:push
:
!!! Caught Server Exception
Taps::InvalidData: Detected data that exceeds the length limitation of its column. This is
generally due to the fact that SQLite does not enforce length restrictions.
Table : archived_users
Column : wants_adult_gifts
Type : tinyint(1)
Data : false
What adapter are you using? the C 'mysql2' gem ? or the C 'mysql' gem ?
I'm using the mysql
gem (version 2.8.1).
Here's a temporary workaround for this problem. After running this, I was able to heroku db:push
successfully:
script/dbconsole
set sql_mode='STRICT_ALL_TABLES';
alter table archived_users modify wants_adult_gifts int;
(The sql_mode line is to be sure no data is lost in the conversion from tinyint to int).