sdepold/sequelize — Issue #133: deletedAt on find
Author: piotrek-r
Created: 2012-03-07 10:24:34+00:00
State: open

I've tried many of ORMs for node.js and I like yours the most. I relay hard on deletedAt features in my databases. I don't like to delete stuff forever. But I found out that sequelize ignore's deletedAt on find() requests.

I've got the common code:

```javascript
var Sequelize = require('sequelize');

var sequelize = new Sequelize('db', 'root', 'pass');

var Project = sequelize.define('Project', {
title: Sequelize.STRING,
description: Sequelize.TEXT
}, {paranoid: true});
```

And then all of them run one after another all including the first one:

```javascript
sequelize.sync();
```

```javascript
var project = Project.build({
'title': 'My Second Task Title',
'description': 'Task description for task number two.'
});
project.save();
```

```javascript
Project.find(1).success(function(project) {
project.destroy();
});
```

```javascript
Project.find(1).success(function(project) {
console.log(project);
});
```

I guess console on the last one should return null. Also find(All) should be prepared to omit adding deletedAt IS NULL on request.

Anyway, great job on the module!