In this thread, I suggested how to block deleting a record if it has child records, thus protecting it from leaving orphaned child records. It would use a status column that counts child records and if status is 0, then based on User Permissions, the record is free to delete. If status is 1, it’s blocked.
While the system is not DIFFICULT to implement, I never implemented it even though I suggested how. Simply because having to set this kind of rules manually, creating a maze in the rules table, becomes way too complicated. Grist could do it automatically, behind the curtains, with some CHECK button when setting child records.
I do it exactly as you propose, however I believe it would be much more robust and fool-proof if the mechanism was implemented through foreign keys at the SQLite level
I do it this way as well, it’s pretty easy to setup with a “count” column and Access Rules.
I agree, however, that Grist tables could/should have a flag like “prevent deletions if columns are referenced by other tables”, and I would default it to “Yes”.