brocaar commented on issue #1381: URL: https://github.com/apache/answer/issues/1381#issuecomment-3188086102
Hi @LinkinStars thanks for your quick response. > Firstly and most fundamentally.... Ok, I understand your answer and I guess this is personal and debatable. However FKs means that data integrity can be enforced at the database level. > Secondly, xorm does not support the use of foreign keys Yes, I see that now. > Finally, from a business point of view That is not really what I'm suggesting and I agree this might not what you want. E.g. you could use `ON DELETE SET NULL` to explicitly set the `user_id` to `NULL` in case the user gets deleted, use `ON DELETE RESTRICT` to prevent a record from being deleted when other records are referencing to it or `ON DELETE CASCADE` to remove all referencing records. I think that provides all the options for various scenarios. --- Just to provide a bit more context, with v1.6.0 I ran into the same issue as https://meta.answer.dev/questions/D1q53/tags-cannot-be-deleted. After the initial setup and playing a bit around, I deleted all questions that were automatically created. In the tags overview it showed there were still two questions using the tag, clicking on the tag there were none. Still I could not delete the tag as I got the "Tags cannot be deleted" error. I suppose this could be because the questions count are cached somewhere, and the validation is done in software and not at the database level. Or maybe there were still some dangling records pointing to the tag which were not deleted when the questions were deleted. If I run into this issue again, I will do some further investigation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
