Question: Missing foreign key constraint from users to namespaces
Hi,
I was doing some nasty stuff this morning, deleting users in the database (DELETE FROM users
, DELETE FROM identities
). However, this left some user data hanging in the namespaces
table and gave me a hard-to-debug error when trying to recreate the user (because there was already a conflicting namespace record.)
I know deleting data right in the database is not the best of ideas (...) but it still made me curious: there are many foreign key constraints that makes deletion of a users
record also cascade to delete related data. Is there a particular reason why the associated namespace is not set up via a foreign key relation per se?
(One obvious reason I can think of: namespaces can be connected to either a team or a user, so a proper foreign key relation is hard to set up in this case.)