Skip to content

Commit 5a36d7e

Browse files
committed
translate SQLITE_CONSTRAINT_FOREIGNKEY error
1 parent 851a217 commit 5a36d7e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sqlite.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ func (dialector Dialector) Translate(err error) error {
243243
return gorm.ErrDuplicatedKey
244244
case sqlite3.SQLITE_CONSTRAINT_PRIMARYKEY:
245245
return gorm.ErrDuplicatedKey
246+
case sqlite3.SQLITE_CONSTRAINT_FOREIGNKEY:
247+
return gorm.ErrForeignKeyViolated
246248
}
247249
}
248250
return err

0 commit comments

Comments
 (0)