Skip to content

Commit 0023894

Browse files
committed
fix: issue if field name is a reserved word
1 parent 38032a6 commit 0023894

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SQLLoader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ public function beginData(array $data): static
376376
public function withHeaders(): static
377377
{
378378
$this->options(['skip=1']);
379-
$this->defaultColumns = CsvFile::make($this->inputFiles[0]->path, 'r')->getHeaders();
379+
$headers = CsvFile::make($this->inputFiles[0]->path, 'r')->getHeaders();
380+
$headers = array_map(fn ($field) => strtoupper('"'.$field.'"'), $headers);
381+
$this->defaultColumns = $headers;
380382

381383
return $this;
382384
}

0 commit comments

Comments
 (0)