getConnection(), $migrationsDir, $storage); $runner->runPending(true); @file_put_contents($stampFile, $fingerprint); } catch (\Throwable $e) { error_log('Automatische Migration fehlgeschlagen: ' . $e->getMessage()); } finally { flock($lock, LOCK_UN); fclose($lock); } } /** Hash ueber Namen und Groessen aller Migrationsdateien. */ public static function fingerprint(string $migrationsDir): string { $files = glob($migrationsDir . '/*.sql') ?: []; sort($files); $parts = []; foreach ($files as $file) { $parts[] = basename($file) . ':' . (int)@filesize($file); } return hash('sha256', implode('|', $parts)); } }