loopback-softdelete-mixin icon indicating copy to clipboard operation
loopback-softdelete-mixin copied to clipboard

_isDeleted is not saving properly in MySQL Database

Open saggafarsyad opened this issue 8 years ago • 2 comments

I'm using MySQL for datasource. I set my deletedAt as deleted_at and _isDeleted as is_deleted. As far as I know, _isDeleted is a boolean type, or I should be expecting 0 or 1. Instead, it only save empty brackets {}, regardless it has been deleted or not

I also cannot skip _isDeleted on create data, I should write the value of _isDeleted. It would be nice if I can skip this

saggafarsyad avatar Mar 25 '16 17:03 saggafarsyad

Hi guys! I'm getting the same Validation Error when inserting a model.. seems like the default _isDeleted is not working, at least in PostgreSQL and MySQL

The MyModel instance is not valid. Details: _isDeleted can't be blank (value: undefined).

Thank you!!!

fuzzball1980 avatar May 17 '16 01:05 fuzzball1980

Hi guys! I have solved the problem adding the type String to the definition.

Model.defineProperty(_isDeleted, { type: String, required: true, default: false });

fuzzball1980 avatar May 17 '16 02:05 fuzzball1980