soft-delete

Soft delete in Sails/Waterline

纵然是瞬间 提交于 2019-12-12 11:16:48
问题 Trying to delete a user model using: //Hard Delete User.destroy({id:userId}, function(err, res){ //Hard Delete }) I need to do a soft delete on User model and currently setting a flag isDeleted to true on delete and updating document: updateUser.isDeleted = true; User.update({id:userId}, updateUser, function(err, res){ Update project }) and while fetching documents I am doing a check If isDeleted - true or not. Is there any In-built feature provided by Sails or Waterline which I can configure

Soft Delete vs. DB Archive

柔情痞子 提交于 2019-12-12 07:31:36
问题 Suggested Reading Similar: Are soft deletes a good idea? Good Article: http://weblogs.asp.net/fbouma/archive/2009/02/19/soft-deletes-are-bad-m-kay.aspx How I ended up here I strongly belive that when making software, anything done up front to minimize work later on pays off in truck loads. As such, I am trying to make sure when approaching my database schema and maintenance that it can maintain relational integrity while not being archaic or overly complex. This resulted in a sort of shudder

ActionController::ParameterMissing with custom route

回眸只為那壹抹淺笑 提交于 2019-12-11 12:29:05
问题 I am building a digital library, and right now I am currently trying to add soft_delete to an application, but I am having issues with the error showing ActionController::ParameterMissing in BooksController#update param is missing or the value is empty: book The action of the soft_delete method is to update its table in the database from its default false value to true. I have checked through my code but I cannot find where the issue is from. Books Model class Book < ApplicationRecord #add a

soft delete common attributes with regards to cascade recovery

十年热恋 提交于 2019-12-11 11:09:03
问题 What type of fields are generally used to accompany soft delete? Any of these, any others? bool IsDeleted // nice because the default value is 0 (no) just in case date DateDeleted // is this a common one? date DateCreated // more of a temporal db aspect date DateModified // same with respect to created The reason I ask is that when using soft-deletes, cascading must still be implemented in order to maintain integrity. However, the real trick is not cascade deleting, which is rather easy. The

Get onlyTrashed() does not exist in query builder

别说谁变了你拦得住时间么 提交于 2019-12-11 02:58:33
问题 I am trying to get trashed rows from table messages: public function trash() { return $this->onlyTrashed() ->where('user_id', '=', $this->_u) ->orWhere('receiver', '=', $this->_u) ->orderBy('deleted_at', 'desc')->get(); } I get this error: Method Illuminate\Database\Query\Builder::onlyTrashed does not exist. I checked up Builder and SoftDeletes files for onlyTrashed method and it does not exist, how can I look up to trashed messages from message table? The only way I think about is to create

How can I suppress execution from an Entity Framework 6 IDbCommandTreeInterceptor?

本秂侑毒 提交于 2019-12-11 02:38:07
问题 I implemented the soft-delete pattern demonstrated by Rowan Miller during a TechEd session but I ran into an immediate problem because I am using inheritance in my Code First model. The first error was during queries because I put the IsDeleted property on my supertype (base class) but when I intercepted the query for a subtype and tried to add the filter, EF complained that there was no such property on that type. Fair enough, I moved the properties to the subtypes and that bit worked okay.

How to check if row is soft-deleted in Eloquent?

和自甴很熟 提交于 2019-12-10 12:28:47
问题 In Laravel 5.1 is there a nice way to check if an eloquent model object has been soft-deleted? I'm not talking about selecting data but once I have the object e.g. Thing::withTrashed()->find($id) So far the only way I can see is if ($thing->deleted_at !== null) { ... } I do not see any relevant method in the API that would allow for example if ($thing->isDeleted()) { ... } 回答1: Just realised I was looking in the wrong API. The Model class doesn't have this, but the SoftDelete trait that my

Soft Delete - Use IsDeleted flag or separate joiner table?

╄→гoц情女王★ 提交于 2019-12-08 16:29:49
问题 Should we use a flag for soft deletes, or a separate joiner table? Which is more efficient? Database is SQL Server. Background Information A while back we had a DB consultant come in and look at our database schema. When we soft delete a record, we would update an IsDeleted flag on the appropriate table(s). It was suggested that instead of using a flag, store the deleted records in a seperate table and use a join as that would be better. I've put that suggestion to the test, but at least on

Laravel force delete event on relations

时光毁灭记忆、已成空白 提交于 2019-12-08 03:05:58
问题 I'm developing a Laravel web app using Laravel 5.2. My question is very simple... How do I listen to a forceDelete event in order to forceDelete model relations? I've been looking around the web and S.O. for a few but all the questions/answers I've found where releted to the delete method, and also in the API documentation I haven't found very much... In my case I have a Registry model and a RegistryDetail model Registry table |id|name|surname|.... RegistryDetail table |id|id_registry|.... I

Reasons for cascading soft deletes [closed]

僤鯓⒐⒋嵵緔 提交于 2019-12-07 08:32:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . In a relational database it seems quite common to use soft-deletes. My pondering comes to if it is really necessary to cascade these deletes? The reason I wonder is that it seems to me that cascading a soft delete wouldn't add any additional information. I.e. lets say we have a