Search code examples
go-gorm

Deactivate soft delete in Gorm


I want to use the Gorm 'gorm.Model' for my data models but this contains the DeletedAt field which activates the soft deletion feature. Is there a way to deactivate it or do I have to duplicate this struct?


Solution

  • You can delete matched records permanently with Unscoped
    db.Unscoped().Delete(&order)

    https://gorm.io/docs/delete.html#Delete-permanently