| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/codex/releases/20260610222256/app/Support/ |
Upload File : |
<?php
namespace App\Support;
use Illuminate\Support\Facades\DB;
/**
* Returns the right case-sensitive binary collation name for the current
* connection's driver. Used in migrations on every ULID + slug column.
*
* MySQL 8: 'utf8mb4_bin' — Crockford ULIDs and accented slug look-alikes
* compare as distinct values (the plan's load-bearing requirement).
* SQLite: 'BINARY' — SQLite's built-in byte-comparison collation,
* semantically identical to utf8mb4_bin for the column shapes Codex
* uses (lowercase ULIDs + kebab-case slugs).
*
* Centralises the driver branch so the migrations stay flat. The Phase 7
* schema-introspection test re-asserts utf8mb4_bin in MySQL specifically.
*/
final class BinaryCollation
{
public static function name(?string $driver = null): string
{
$driver ??= DB::connection()->getDriverName();
return match ($driver) {
'mysql', 'mariadb' => 'utf8mb4_bin',
'sqlite' => 'BINARY',
default => 'utf8mb4_bin',
};
}
}