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, + ], + ]); + } +} 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)); + } +}