You've already forked Epicnabbo-Catalogus-Updated-Daily
Update 2014_01_01_000000_core_sql_file.php
This commit is contained in:
@@ -13,7 +13,7 @@ class CoreSqlFile extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Only run in testing environment
|
// Only run in testing environment
|
||||||
if (app()->environment() !== 'testing') {
|
if (app()->environment() !== 'testing') {
|
||||||
@@ -31,10 +31,14 @@ class CoreSqlFile extends Migration
|
|||||||
|
|
||||||
$sqlFile = database_path('migrations/sqls/default.sql');
|
$sqlFile = database_path('migrations/sqls/default.sql');
|
||||||
$sql = file_get_contents($sqlFile);
|
$sql = file_get_contents($sqlFile);
|
||||||
|
if (! is_string($sql)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Split into individual statements to show progress
|
// Split into individual statements to show progress
|
||||||
|
$split = preg_split('/;\s*\n/', $sql) ?: [];
|
||||||
$statements = array_filter(
|
$statements = array_filter(
|
||||||
preg_split('/;\s*\n/', $sql),
|
$split,
|
||||||
fn ($stmt) => ! empty(trim($stmt)) &&
|
fn ($stmt) => ! empty(trim($stmt)) &&
|
||||||
! str_starts_with(trim($stmt), '--') &&
|
! str_starts_with(trim($stmt), '--') &&
|
||||||
! str_starts_with(trim($stmt), '/*'),
|
! str_starts_with(trim($stmt), '/*'),
|
||||||
|
|||||||
Reference in New Issue
Block a user