mysql2sqlite
mysql2sqlite copied to clipboard
default foreign key behavior
In MySQL the default foreign key ON DELETE behavior is RESTRICT, in SQLite it's NO ACTION. I think it would make sense if this script would automatically add "ON DELETE RESTRICT" to the end of foreign keys in MySQL that don't specify the ON DELETE, so that the default behavior matches.
In my MySQL database I specifically have the foreign keys set to ON DELETE RESTRICT and yet in the resulting mysqldump they are not specified, so it's not a case of just having them set to the defaults.
Sounds good to me. I'm very busy unfortunately (see all the PRs waiting for thorough review - would you help with that?), so if you want this to happen, please make a PR.
And if you want it merged soon, please review several other PRs and I'll try my best to find the time to review yours :wink: (or you can find another person to review your PR).
Unfortunately I am not at all familiar with awk scripting but if I get a chance I will certainly give it a try.
Note that this is still a bug, but not as big of a deal as I originally thought. NO ACTION in SQLite just means the check is deferred until the end of the transaction, not that it doesn't happen at all. In MySQL both NO ACTION and RESTRICT do the check immediately.