Soft delete
Set options.softDelete to true to mark records as deleted rather than permanently removing them from the database. This process allows for data recovery and maintains audit trails.
Behavior
When softDelete is enabled, the Manta SDK performs the following actions:
- Sets a
deletedAttimestamp on the targeted records. - If a
deletedAtfield does not exist, it may create a new boolean field calleddeleteByMantaand set it totrue.
Usage
- Manta Studio
- PostgreSQL
TypeScript
// Soft delete inactive users in Manta Tables
await manta.deleteRecords({
table: "user",
where: { status: "inactive" },
options: {
softDelete: true
},
});
TypeScript
// Soft delete inactive users in your external Postgres database
await manta.deleteRecords({
db: "production_db",
table: "user",
where: { status: "inactive" },
options: {
softDelete: true
},
});