Update 2014_01_01_000000_core_sql_file.php

This commit is contained in:
Remco
2026-01-19 22:35:14 +01:00
parent d45fa5cdcb
commit e7d5d6179b
@@ -13,7 +13,7 @@ class CoreSqlFile extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
// Only run in testing environment
if (app()->environment() !== 'testing') {
@@ -31,10 +31,14 @@ class CoreSqlFile extends Migration
$sqlFile = database_path('migrations/sqls/default.sql');
$sql = file_get_contents($sqlFile);
if (! is_string($sql)) {
return;
}
// Split into individual statements to show progress
$split = preg_split('/;\s*\n/', $sql) ?: [];
$statements = array_filter(
preg_split('/;\s*\n/', $sql),
$split,
fn ($stmt) => ! empty(trim($stmt)) &&
! str_starts_with(trim($stmt), '--') &&
! str_starts_with(trim($stmt), '/*'),