From 80ad185066e997ca28ee032217ada40c09ecb21d Mon Sep 17 00:00:00 2001
From: Seamus Lee <seamuslee001@gmail.com>
Date: Fri, 12 Jun 2020 13:17:48 +1000
Subject: [PATCH] Fix unit test failures on MySQL 5.6 due to Custom Field table
 being created without Dynamic Row Format

---
 CRM/Core/BAO/CustomField.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php
index 826a18c45d2..7c6350553b5 100644
--- a/CRM/Core/BAO/CustomField.php
+++ b/CRM/Core/BAO/CustomField.php
@@ -1631,6 +1631,12 @@ SELECT $columnName
       ],
     ];
 
+    // If on MySQL 5.6 include ROW_FORMAT=DYNAMIC to fix unit tests
+    $databaseVersion = CRM_Utils_SQL::getDatabaseVersion();
+    if (version_compare($databaseVersion, '5.7', '<') && version_compare($databaseVersion, '5.6', '>=')) {
+      $table['attributes'] = $table['attributes'] . ' ROW_FORMAT=DYNAMIC';
+    }
+
     if (!$params['is_multiple']) {
       $table['indexes'] = [
         [
-- 
GitLab