PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]); $pdo->exec('PRAGMA foreign_keys = ON'); // Apply every NNN_*.sql in order — matches the production Migrator. $dir = __DIR__ . '/../migrations'; $files = glob($dir . '/*.sql') ?: []; sort($files); foreach ($files as $file) { if (!preg_match('#/\d{3,}_[A-Za-z0-9_\-]+\.sql$#', $file)) { continue; } $sql = file_get_contents($file); if ($sql === false) { $this->fail("Could not read migration: {$file}"); } $pdo->exec($sql); } return $pdo; } }