From 2ccc6dd141b4b1df148fbe36fe7bef578673afd0 Mon Sep 17 00:00:00 2001 From: FreeScout Date: Thu, 28 Oct 2021 05:51:19 -0700 Subject: [PATCH] Disable sql_require_primary_key=0 for PostgreSQL - closes #1518 --- app/Misc/Helper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Misc/Helper.php b/app/Misc/Helper.php index d2ff0325..3dad42e3 100644 --- a/app/Misc/Helper.php +++ b/app/Misc/Helper.php @@ -1418,9 +1418,13 @@ class Helper /** * Disable sql_require_primary_key option to avoid errors when migrating. + * Only for MySQL. */ public static function disableSqlRequirePrimaryKey() { + if (!self::isMySql()) { + return; + } try { \DB::statement('SET SESSION sql_require_primary_key=0'); } catch (\Exception $e) {