Skip to content

Commit

Permalink
Catch empty dbs
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnorthrip committed Mar 14, 2024
1 parent 09aa2e2 commit 2e81655
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Commands/DBPull.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,17 @@ public function handle()

public function local_tables_key()
{
return array_keys(get_object_vars(DB::select('SHOW TABLES')[0]))[0];
$tables = DB::select('SHOW TABLES');
return (!$tables)?
null :
array_keys(get_object_vars($tables[0]))[0];
}

public function local_get_tables()
{
return Arr::pluck(DB::select('SHOW TABLES'), $this->local_tables_key());
return (!$this->local_tables_key())?
[] :
Arr::pluck(DB::select('SHOW TABLES'), $this->local_tables_key());
}

public function local_drop_all_tables()
Expand Down

0 comments on commit 2e81655

Please sign in to comment.