OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace Leantime\Core\Database;
use Illuminate\Database\PostgresConnection;
/**
* Custom PostgreSQL connection that handles MySQL-isms in the Leantime codebase.
*
* MySQL silently coerces empty strings to appropriate zero/null values for
* non-string column types (datetime, integer, float). PostgreSQL does not.
* This connection class converts empty string bindings to null so that
* existing repository code works without modification on PostgreSQL.
*
* String columns that legitimately need empty strings should be defined as
* nullable() in the SchemaBuilder so they accept null gracefully.
*/
class LtPostgresConnection extends PostgresConnection
{
/**
* Prepare the query bindings for execution.
*
* Converts empty strings to null for PostgreSQL compatibility.
* MySQL treats '' as NULL/zero for datetime, int, and float columns,
* but PostgreSQL rejects them with type errors.
*
* @return array
*/
public function prepareBindings(array $bindings)
{
$bindings = parent::prepareBindings($bindings);
foreach ($bindings as $key => $value) {
if ($value === '') {
$bindings[$key] = null;
}
}
return $bindings;
}
}