Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] - Fix common backup-restore issues instead of dumping data #3219

Open
michael-genson opened this issue Feb 24, 2024 · 1 comment
Open
Labels
task General Task that needs to be completed v1 Version 1 Issue/PR

Comments

@michael-genson
Copy link
Collaborator

What is the problem this task addresses?

Currently, when restoring a backup, any rows with invalid foreign keys are dropped (see #2986). This is a fair "catch-all" solution, but we can do better for more common issues (such as #3171)

Proposed/Possible Solution(s)?

Scan the database JSON before attempting to import and fix some common issues. Specifically, looking at #3171, I can think of two:

  1. If an invalid user_id is found, replace it with a valid one (find any admin user, similar to: feat: Filter Out Shopping Lists That Aren't Yours #3213)
  2. If an invalid group_id is found, replace it with a valid one (using an admin user, same as above)

This should fix the most egregious of errors (e.g. deleting recipes that belong to missing users)

@michael-genson michael-genson added task General Task that needs to be completed v1 Version 1 Issue/PR labels Feb 24, 2024
@tba-code
Copy link
Contributor

tba-code commented Apr 4, 2024

It would be kind of nice if there was a placeholder user and group that could be used for orphaned entries. like a group that you cant be added to, and a user that cant be logged in as that are just for placeholders in these situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task General Task that needs to be completed v1 Version 1 Issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants