pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
304 stars 444 forks source link

Fix remaining missing foreign key declarations #8333

Open asmecher opened 2 years ago

asmecher commented 2 years ago

This issue is a continuation of https://github.com/pkp/pkp-lib/issues/6093.

The remaining missing foreign key constraints will require some code changes to move away from the use of 0 as a reserved case.

Some of these areas are slated for rewriting, so this work may be a lower priority than the rewrite.

It makes sense to keep the email_log even when a sender (user) is deleted, but it's probably needed to review GDPR (e.g. right to be forgotten), as the email might keep personal data.

jonasraoni commented 1 year ago

I've updated the issue description (added the missing user_groups.context_id and marked others as done), and created initial PRs from detached commits of another issue.

jonasraoni commented 1 year ago

Added the site.redirect field, I think it's also better to get it renamed to redirect_context_id.

asmecher commented 5 months ago

@jonasraoni, can you dust off any remaining PRs here and summarize?

jonasraoni commented 5 months ago

Yep, I've got a couple of PRs to dust off, I'll add this one to the list 😁

asmecher commented 2 months ago

@jonasraoni, a tweak is required on this one: you're using ALTER TABLE t RENAME INDEX old_name TO new_name, which is only available in MariaDB as of version 10.5.2. My Ubuntu ships with 10.3.39 and I think there will probably be lots of ISPs using older versions too. Could you check if there's a workaround that'll support older MariaDBs?

asmecher commented 1 month ago

This changeset renamed the notification_subscription_settings_context index to notification_subscription_settings_context_id -- just an index rename, no functional change. However...

I've backed out the change. If we do decide to rename it, let's wait until we can set a baseline MariaDB/MySQL requirement that'll allow us to do it cleanly (e.g. without deleting and re-creating it, which will disturb foreign key constrants). It's just cosmetic.