fguillot/kanboard — pull request #71 by toomyem (2014-04-10 14:03:45+00:00)
Title: Fixed invalid constraint for comments table in sqlite schema

I noticed that there is probably a mistake in schema defining comments table for sqlite. There are two foreign keys defined:

FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
FOREIGN KEY(user_id) REFERENCES tasks(id) ON DELETE CASCADE

Note that second one is referring to __tasks__ table, not to __users__.

To fix this I have added new version function (version_11) which alters this constraint. Because as far as I know in sqlite it is not possible to alter constraint in existing table, I had to rename comments table to temporary name, then create new table with correct constraints, then copy all content from old table to the new one, and finally drop temporary table.

If there is simpler solution, I will be happy to hear about it :)

Thanks.