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

add soft delete to card, deck, membership, and user #110

Merged
merged 8 commits into from
Jan 23, 2025

Conversation

jxjj
Copy link
Collaborator

@jxjj jxjj commented Jan 23, 2025

Adds soft delete functionality to:

  • Decks
  • Cards
  • Users
  • Deck memberships

The Deck Invite controller is updated so that if a membership was previously soft deleted and the user clicks on a share link to rejoin, the controller will restore the membership and set the role to match the link (which maybe be different from when they were last a member).

On dev for testing.

jxjj added 4 commits January 22, 2025 20:40
When migrating fresh, old migrations will fail if they use the eloquent model directly instead of `DB::table` because the model now expects a `deleted_at` column.

This rewrites the migrations to use DB::table.
@jxjj jxjj requested a review from cmcfadden January 23, 2025 05:41
@jxjj jxjj self-assigned this Jan 23, 2025
@jxjj jxjj linked an issue Jan 23, 2025 that may be closed by this pull request
jxjj added 4 commits January 23, 2025 12:19
adding soft deletes on deck memberships introduces complexity. Because there's a uniqueness constrain on the `deck_memberships` table, re-adding a member would mean that we need to restore the previous membership OR we need to work around the uniqueness constraint (perhaps by adding an additional constraint of `deleted_at`).

In practice though, we don't need this soft delete. The user's practice data is directly associated with the `user_id` and the `deck_id`, not a `deck_memberships.id`. So if we removing a deck membership, any practice data would not be swept up in the cascade.
matching previous state for cleaner pr
@jxjj jxjj merged commit 3de165a into develop Jan 23, 2025
2 checks passed
@jxjj jxjj deleted the feature/add-soft-deletes branch January 23, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable soft deletes of db stuff
1 participant