Fixes #30. Delete cascade for messages and thread ids