From 711089ce3fac237a5c57cf0c5f2e96298c287d12 Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 20 Jul 2026 18:42:06 +0200 Subject: [PATCH 1/2] fix(database): use VARCHAR(MAX) for SQLSRV setting values --- ...-07-20-181246_ConvertSqlsrvValueColumn.php | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/Database/Migrations/2026-07-20-181246_ConvertSqlsrvValueColumn.php diff --git a/src/Database/Migrations/2026-07-20-181246_ConvertSqlsrvValueColumn.php b/src/Database/Migrations/2026-07-20-181246_ConvertSqlsrvValueColumn.php new file mode 100644 index 0000000..cf86ef1 --- /dev/null +++ b/src/Database/Migrations/2026-07-20-181246_ConvertSqlsrvValueColumn.php @@ -0,0 +1,51 @@ +config = config('Settings'); + $this->DBGroup = $this->config->database['group'] ?? null; + + parent::__construct($forge); + } + + public function up(): void + { + if ($this->db->getPlatform() !== 'SQLSRV') { + return; + } + + $this->forge->modifyColumn($this->config->database['table'], [ + 'value' => [ + 'type' => 'VARCHAR', + 'constraint' => 'MAX', + 'null' => true, + ], + ]); + } + + public function down(): void + { + if ($this->db->getPlatform() !== 'SQLSRV') { + return; + } + + $this->forge->modifyColumn($this->config->database['table'], [ + 'value' => [ + 'type' => 'TEXT', + 'null' => true, + ], + ]); + } +} From e1aa617a3d8f9d90d9a8c2ac91114e7bcf5d5ea7 Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 20 Jul 2026 18:49:54 +0200 Subject: [PATCH 2/2] fix(database): serialize boolean setting values as strings --- src/Handlers/BaseHandler.php | 2 +- tests/BaseHandlerTest.php | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/BaseHandlerTest.php diff --git a/src/Handlers/BaseHandler.php b/src/Handlers/BaseHandler.php index 8649c7a..3a6cfc5 100644 --- a/src/Handlers/BaseHandler.php +++ b/src/Handlers/BaseHandler.php @@ -109,7 +109,7 @@ public function persistPendingProperties(): void protected function prepareValue($value) { if (is_bool($value)) { - return (int) $value; + return $value ? '1' : '0'; } if (is_array($value) || is_object($value)) { diff --git a/tests/BaseHandlerTest.php b/tests/BaseHandlerTest.php new file mode 100644 index 0000000..955c947 --- /dev/null +++ b/tests/BaseHandlerTest.php @@ -0,0 +1,22 @@ +assertSame('1', $prepareValue(true)); + $this->assertSame('0', $prepareValue(false)); + } +}