GORM Playground Link

https://github.com/go-gorm/playground/pull/610

Description

This bug is happening only on gorm >= 1.25. save() is successfully applied with a record that has a foreign key soft deleted.

For example, having two models, a person, and a document. If the person is deleted (soft delete) and saves a new document with a foreign key to the person, it's allowing save and the document will be orphan data in the database.

I would guess the issue is related to the changes on SaveBeforeAssociation https://github.com/go-gorm/gorm/compare/v1.24.6...v1.25.0

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking