diff --git a/lib/SimpleSAML/Store/SQL.php b/lib/SimpleSAML/Store/SQL.php index 9a3666a7c7fdbf6ef2aa66efd28db5270545681b..534f2eaee6036db1e7e95ffdd0cbb005f2ce569e 100644 --- a/lib/SimpleSAML/Store/SQL.php +++ b/lib/SimpleSAML/Store/SQL.php @@ -95,7 +95,12 @@ class SimpleSAML_Store_SQL extends SimpleSAML_Store { return; } - $query = 'CREATE TABLE ' . $this->prefix . '_kvstore (_type VARCHAR(30) NOT NULL, _key VARCHAR(50) NOT NULL, _value TEXT NOT NULL, _expire TIMESTAMP, PRIMARY KEY (_key, _type))'; + $text_t = 'TEXT'; + if ($this->driver === 'mysql') { + // TEXT data type has size constraints that can be hit at some point, so we use LONGTEXT instead + $text_t = 'LONGTEXT'; + } + $query = 'CREATE TABLE ' . $this->prefix . '_kvstore (_type VARCHAR(30) NOT NULL, _key VARCHAR(50) NOT NULL, _value '.$text_t.' NOT NULL, _expire TIMESTAMP, PRIMARY KEY (_key, _type))'; $this->pdo->exec($query); $query = 'CREATE INDEX ' . $this->prefix . '_kvstore_expire ON ' . $this->prefix . '_kvstore (_expire)';