From 001738be49d26d341f88377d6006356573c9d045 Mon Sep 17 00:00:00 2001 From: Muhammad Amir Ejaz <37077032+codingamir@users.noreply.github.com> Date: Sun, 21 May 2023 18:27:22 +0500 Subject: [PATCH] Added support of "Violates Foreign Key Constraint" (#6329) * Added support of "Violates Foreign Key Constraint" Updated the translator and added the support of "foreign key constraint violation". For this, this error type is needed here. * changed the description of ErrForeignKeyViolated --- errors.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/errors.go b/errors.go index 57e3fc5e..cd76f1f5 100644 --- a/errors.go +++ b/errors.go @@ -47,4 +47,6 @@ var ( ErrPreloadNotAllowed = errors.New("preload is not allowed when count is used") // ErrDuplicatedKey occurs when there is a unique key constraint violation ErrDuplicatedKey = errors.New("duplicated key not allowed") + // ErrForeignKeyViolated occurs when there is a foreign key constraint violation + ErrForeignKeyViolated = errors.New("violates foreign key constraint") )