soft-delete

Logical delete at a common place in hibernate

一个人想着一个人 提交于 2019-12-07 06:08:37
I am using Spring and Hibernate for my application. I am only allowing logical delete in my application where I need to set the field isActive=false. Instead of repeating the same field in all the entities, I created a Base Class with the property and getter-setter for 'isActive'. So, during delete, I invoke the update() method and set the isActive to false. I am not able to get this working. If any one has any idea, please let me know. Base Entity public abstract class BaseEntity<TId extends Serializable> implements IEntity<TId> { @Basic @Column(name = "IsActive") protected boolean isActive;

Laravel force delete event on relations

放肆的年华 提交于 2019-12-06 08:59:13
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've created for both this boot function: protected static function boot() { parent::boot(); static:

Soft Delete Nhibernate

折月煮酒 提交于 2019-12-06 06:24:18
问题 I want to make a soft delete on my db table...i have apply following statement (as described here http://nhibernate.info/blog/2008/09/06/soft-deletes.html and in a lot of question on SO). Fattura is my table where i want apply logical delete (there is no trigger on it) Fattura.hbm.xml <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Paggentola.Gestionale.DL.Model" namespace="Paggentola.Gestionale.DL.Model"> <class name="Fattura" table=

How to determine if a model uses soft deletes in Laravel 4.2

孤者浪人 提交于 2019-12-06 05:45:37
问题 How do I determine if a model uses soft deletes in Laravel 4.2? In the Laravel API I found the function isSoftDeleting(), but apparently that was removed from Laravel 4.2 now that it uses the SoftDeletingTrait. How would I go about determining if a model uses soft deletes now? 回答1: If you want to check programatically whether a Model uses soft deletes you can use the PHP function class_uses to determine if your model uses the SoftDeletingTrait // You can use a string of the class name $traits

Entity Framework 6 Disable Interception temporarily

有些话、适合烂在心里 提交于 2019-12-06 02:47:52
问题 I am using an IDbCommandTreeInterceptor to enable soft deletes on my model. System.Data.Entity.Infrastructure.Interception.DbInterception.Add( new SoftDeleteInterception()); I want to be able to disable the interceptor temporarily so that I can select a "deleted" entity for auditing purposes. However, It seems like the DbInterception collection is assembly-wide. Is there any way to create a new DbContext without interception on? Or even a way to add the interceptor to the DbContext every time

How to disable soft delete (Soft-deleteable) filter for doctrine in symfony

走远了吗. 提交于 2019-12-05 16:04:06
问题 Installing and using SoftDeleteable behavior extension for Doctrine 2 is quite easy. The problem usually is trying to disable it for some code part and enabling again. You may want to do this to: load entity that is soft-deleted remove entity from database entirely bypassing soft-delete filter So how to disable it? 回答1: 1. How to load soft-deleted entity As per the documentation, disable filter for entity manager: $em->getFilters()->disable('softdeleteable'); $object = $em->find('AppBundle

Reasons for cascading soft deletes [closed]

眉间皱痕 提交于 2019-12-05 12:15:46
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 table MainContract and a table ServiceContract where the relation is one-to-many. Say we soft-delete the MainContract but ignore doing so to lets say three ServiceContracts that all belong to this MainContract. If we query the DB for ServiceContracts that are not deleted, we could easily check if the MainContract owning

How to soft delete related records when soft deleting a parent record in Laravel?

前提是你 提交于 2019-12-05 01:00:41
I have this invoices table that which has the following structure id | name | amount | deleted_at 2 iMac 1500 | NULL and a payments table with the following structure id | invoice_id | amount | deleted_at 2 2 1000 | NULL Invoice Model class Invoice extends Model { use SoftDeletes; } here's the code to delete the invoice public function cance(Request $request,$id) { $record = Invoice::findOrFail($id); $record->delete(); return response()->json([ 'success' => 'OK', ]); } Payments model class Payment extends Model { use SoftDeletes; } The softDelete on Invoice table works perfectly but its

Soft Deletes ( IsHistorical column ) with EntityFramework

匆匆过客 提交于 2019-12-04 18:52:27
问题 I'm working with a database where the designers decided to mark every table with a IsHistorical bit column. There is no consideration for proper modeling and there is no way I can change the schema. This is causing some friction when developing CRUD screens that interact with navigation properties. I cannot simply take a Product and then edit its EntityCollection I have to manually write IsHistorical checks all over the place and its driving me mad. Additions are also horrible because so far

Django, cascading move to a separate table instead of cascading delete

自古美人都是妖i 提交于 2019-12-04 16:43:14
I'd like to keep data when we delete instead of soft-delete (which uses is_deleted field), I'd like to move the data to another table (for deleted rows) https://stackoverflow.com/a/26125927/433570 I don't know what is the name of the strategy either. called archiving? two-table delete? To make this work, I need to be able to do for a given object(which will be deleted), find all other objects that has foreign key or one-to-one key to the object. (this can be done via https://stackoverflow.com/a/2315053/433570 , actually harder than that, that code isn't sufficient) insert a new object and have