Skip to content

serial (auto incremented) Id and deletedAt in BaseEntity #73

Open
@m-salman-afzal

Description

@m-salman-afzal
  • We often require an auto incremented id or sId that needs to be displayed on the front-end for user experience purposes and it is good to have this id for all our models.
  • In a business, we never hard delete anything, no matter how small it is. So, it makes sense that we have a soft delete column deletedAt like createdAt and updatedAt, that will be just need to be updated by the current date while deleting and we can restore that row whenever we need by just setting the same column to null.

Although, it will require additional work on developer side to make sure that while querying the data, is mode.deletedAt IS NULL filter is applied in where filter or not. Some ORMS like typeORM, Sequelize, Prisma provides auto check of deletedAt is null but for the case of drizzleORM, we'll have to manually check for the deletedAt column, but its a simple enough task.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions