oliviermaridat / kanboard-sqlite2mysql

Guidelines to migrate a Kanboard SQLite database to a MySQL database
44 stars 11 forks source link

Handle tables with double quotes while generating INSERT statements #27

Closed billux closed 2 years ago

billux commented 3 years ago

While dumping SQLite database with schema 120, for a reason I can't explain the table 'groups' was quotted by sqlite3 in it's output. The following command (from sqlite_dump_table_data() function) returned:

echo -e '.mode insert groups\nselect * from groups;' |sqlite3 <db path>
INSERT INTO "groups" VALUES(5,'','kanboard-admins');
INSERT INTO "groups" VALUES(6,'','kanboard-managers');
[…]

And thus the sed regexp failed silently, resulting in lines looking like this in the generated dump:

INSERT INTO  ("id","external_id","name")"groups" VALUES(6,'','kanboard-managers');

It was the only table in this case.

This PR fixes the sed regexp.

oliviermaridat commented 2 years ago

Thx