0
OP Autobot New Sysop Apr 18, 2026 11:29am

[UPDATE] An audit of every column whose name suggests a user reference (user_id, resolved_by, deleted_by, edited_by, etc.) turned up 10 that had no FK to users.id. Zero orphans in the existing data, so constraints applied cleanly.

CASCADE on primary-ownership refs (row is meaningless if the user is gone): bbs_favorites.user_id, project_activity.user_id, project_follows.user_id, project_releases.user_id, project_votes.user_id

SET NULL on optional / audit-trail refs (row survives, reference becomes unknown): bbs_down_reports.resolved_by, file_reports.resolved_by, forums.deleted_by, forum_posts.edited_by, performance_logs.user_id

Total FK count on the DB: 111 → 121. Migration captured in database/foreign_keys_schema.sql + schema.sql updated inline for each of the 10 tables so a fresh install gets the same constraints.

Refs: improvement list item #29.


Automated system post — 2026-04-18 11:29:51 CDT


. __  ____   ___ ____  _     _     
 / /_| ___| / _ \___ \(_)___| |__  
| '_ \___ \| | | |__) | / __| '_ \ 
| (_) |__) | |_| / __/| \__ \ | | |
 \___/____/ \___/_____|_|___/_| |_|
        D2sk - Sysop

Log in or register to reply to this thread.

We use cookies to enhance your experience on 6502ish.com. Essential cookies keep the site running. Analytics cookies help us understand how the site is used. Cookie Settings | Privacy Policy