# View soft-deleted records

Sequelize supports the concept of [*paranoid* tables](https://sequelize.org/master/manual/paranoid.html). A *paranoid* table is one that, when told to delete a record, it will not truly delete it. Instead, a special column called `deletedAt` will have its value set to the timestamp of that deletion request.

This means that paranoid tables perform a *soft-deletion* of records, instead of a *hard-deletion*.\
\
By default, Forest Admin hides soft-deleted records.\
\
This example will show you **how to view soft-deleted records** within your Forest Admin interface.

{% embed url="<https://www.loom.com/share/30f68ffea7d649c5a9f896dddd5a85c8>" %}

## Define hooks on your model

[Sequelize hooks](https://sequelize.org/v5/manual/hooks.html) are places we can write callbacks that get invoked at key points in time like `afterCreate`, `afterDestroy`, `afterUpdate`, and more.\
\
Here, we'll use `beforeFind` and `beforeCount` hooks ont our Companies model.

```javascript
module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;

  const Companies = sequelize.define('companies', {
    name: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    score: {
      type: DataTypes.INTEGER,
    },
    address: {
      type: DataTypes.STRING,
    },
  }, {
    tableName: 'companies',
    schema: process.env.DATABASE_SCHEMA,
    paranoid: true,
    hooks: {
      beforeFind(options) {
        options.paranoid = false; // Hooks used to display soft-deleted records
      },
      beforeCount(options) {
        options.paranoid = false; // Hooks used to count soft-deleted records
      },
    },
  });

  Companies.associate = (models) => {
  };

  return Companies;
};

```

## Use segments

For better visibility, you can [create a segment](https://app.gitbook.com/s/Ox0Wo3NZjrQrGQthTy6o/collections/segments) to display your deleted records.

![](https://2793709227-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0vHiS-1S9Hw3djvoTw%2F-MY64tQWieGDhsjvOARB%2F-MY65OaE-biu-_Wy6YW3%2Fimage.png?alt=media\&token=2bf8a953-0243-4d08-bd97-a856fdfe5e8c)

{% hint style="info" %}
You can also use the option `Access to records through Segments only` to separate deleted records from the main table view 👇
{% endhint %}

![](https://2793709227-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0vHiS-1S9Hw3djvoTw%2F-MYJa_ZKHdNn1gz88dBN%2F-MYJbCtOgh2Nenl6E0a_%2Fimage.png?alt=media\&token=e0d034b2-dbf1-48a0-8752-1a02ffda8b09)
