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

Soft deletes (.archive()) #1521

Merged
merged 21 commits into from
Oct 3, 2017
Merged

Soft deletes (.archive()) #1521

merged 21 commits into from
Oct 3, 2017

Conversation

mikermcneil
Copy link
Member

No description provided.

…ing from .destroy(). (Still needs some love.)
…p the Archived model (which doesn't exist yet)
… the forging from the find query) so that the destroy() query works. Note: At this point, you can take this and use .archive() at the app-level in your own project, provided you hook up your own Archive model. But in subsequent commits, I'll write some code that injects this model automatically, unless configured otherwise.
@luislobo
Copy link
Contributor

luislobo commented Sep 5, 2017

@mikermcneil I like the archive idea. I see it could be great in some scenarios.
In our use case, we just need the soft-deleted models to be marked as "deleted" on the same instance, and filtered out, as we have history information that still needs to reference the "deleted" models.
We are already handling it with a deleted flag

@mikermcneil mikermcneil merged commit cb7d2aa into master Oct 3, 2017
@mikermcneil
Copy link
Member Author

@luislobo Glad to hear it. And there's totally a place for an isDeleted flag too -- like sometimes you actually want to view the stuff in the UI, etc. For our purposes here, .archive() is really more about just having something that you can use as a drop-in replacement for .destroy() when:

  1. you know you have to keep the "deleted" data somewhere
  2. but you also don't want it complicating things in your app if possible
  3. And you don't need to be able to build any features involving the "deleted" data right away

@luislobo
Copy link
Contributor

luislobo commented Oct 3, 2017

@mikermcneil Yeah, I definitelly see the use and possibilities of archive. We might even use it instead of our current way of doing things. This aligned with some service that "autoarchives" records could be something that we might use.

@mikermcneil mikermcneil changed the title Soft deletes (work in progress) Soft deletes (.archive()) Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants