techouse / sqlite3-to-mysql

Transfer data from SQLite to MySQL

Home Page:https://techouse.github.io/sqlite3-to-mysql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

text field with a default value report error while convert

yonglezhu opened this issue · comments

definition of source table in sqlite is like this:
create table data_source (
...
uid text default 0
)
the key is the type of uid field is text,and it has a default value.
when convert to mysql,it report a error message:
MySQL failed creating table data_source: 1101 (42000): BLOB,TEXT,GEOMETRY or JSON column 'uid' can't have a default value

affect version: 1.4.9
but version 1.4.8 hasn't this issue

I have a look at the source code(create statement concat logic in file transporter.py),then I see the difference:
version 1.4.8(line 304):sql += " {name} {type} {notnull} {auto_increment}, ".format(
version 1.4.9(line 304):sql += " {name} {type} {notnull} {dflt} {auto_increment}, ".format(

I can clearly see version 1.4.9 add the default clause,but mysql don't support BLOB,TEXT,GEOMETRY or JSON column have a default value

Caused by #30

Fixed

Fixed

Thanks