Skip to content

Commit 8652e83

Browse files
committed
Check if synchronizations table exists
This prevents an error (table doesn't exist) that occurs when migrating for the first time.
1 parent c21eb6f commit 8652e83

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Listeners/MigrationStartedEventListener.php

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace LaravelSynchronize\Listeners;
44

5+
use Schema;
56
use SplFileInfo;
67
use Illuminate\Support\Facades\DB;
78
use Illuminate\Support\Facades\Config;
@@ -41,6 +42,10 @@ public function handle(MigrationStarted $migrationStarted)
4142
return;
4243
}
4344

45+
if (!Schema::hasTable(Config::get('synchronizer.table'))) {
46+
return;
47+
}
48+
4449
$class = get_class($migrationStarted->migration) . 'Synchronization';
4550
$files = $this->synchronizer->getSynchronizations();
4651

0 commit comments

Comments
 (0)