Skip to content

Commit

Permalink
translate SQLITE_CONSTRAINT_FOREIGNKEY error
Browse files Browse the repository at this point in the history
  • Loading branch information
glebarez committed Oct 26, 2023
1 parent 851a217 commit 5a36d7e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ func (dialector Dialector) Translate(err error) error {
return gorm.ErrDuplicatedKey
case sqlite3.SQLITE_CONSTRAINT_PRIMARYKEY:
return gorm.ErrDuplicatedKey
case sqlite3.SQLITE_CONSTRAINT_FOREIGNKEY:
return gorm.ErrForeignKeyViolated
}
}
return err
Expand Down

0 comments on commit 5a36d7e

Please sign in to comment.