From 58668a6e801f71f6352d91990491cb41a0657397 Mon Sep 17 00:00:00 2001 From: Thijs Kinkhorst <thijs@kinkhorst.com> Date: Tue, 24 Jul 2018 12:14:09 +0000 Subject: [PATCH] Update logoutstore table migration syntax for PostgreSQL --- modules/saml/lib/SP/LogoutStore.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/saml/lib/SP/LogoutStore.php b/modules/saml/lib/SP/LogoutStore.php index 8d329a8cc..3b98fdbea 100644 --- a/modules/saml/lib/SP/LogoutStore.php +++ b/modules/saml/lib/SP/LogoutStore.php @@ -22,7 +22,16 @@ class LogoutStore return; } elseif ($tableVer === 1) { /* TableVersion 2 increased the column size to 255 which is the maximum length of a FQDN. */ - $query = 'ALTER TABLE ' . $store->prefix . '_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL'; + switch ($store->driver) { + case 'pgsql': + // This does not affect the NOT NULL constraint + $query = 'ALTER TABLE ' . $store->prefix . '_saml_LogoutStore ALTER COLUMN _authSource TYPE VARCHAR(255)'; + break; + default: + $query = 'ALTER TABLE ' . $store->prefix . '_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL'; + break; + } + try { $store->pdo->exec($query); } catch (\Exception $e) { -- GitLab