# 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://docs.forestadmin.com/user-guide/collections/segments) to display your deleted records.

![](/files/-MY65OaE-biu-_Wy6YW3)

{% 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 %}

![](/files/-MYJbCtOgh2Nenl6E0a_)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/woodshop/how-tos/view-soft-deleted-records.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
