Skip to content

Commit 34b4463

Browse files
authored
Merge pull request #1 from yajra/fix-trailing
fix: trailing with date format options
2 parents e498162 + b418e19 commit 34b4463

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/TableDefinition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function __toString(): string
3030
$sql .= "OPTIONALLY ENCLOSED BY '{$this->enclosedBy}'".PHP_EOL;
3131
}
3232

33-
if ($this->trailing) {
34-
$sql .= 'TRAILING NULLCOLS'.PHP_EOL;
35-
}
36-
3733
if ($this->formatOptions) {
3834
$sql .= implode(PHP_EOL, $this->formatOptions).PHP_EOL;
3935
}
4036

37+
if ($this->trailing) {
38+
$sql .= 'TRAILING NULLCOLS'.PHP_EOL;
39+
}
40+
4141
$sql .= '('.PHP_EOL;
4242
if ($this->columns) {
4343
$sql .= implode(

tests/Unit/TableDefinitionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
);
1818

1919
assertEquals(
20-
"INTO TABLE users\nFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\nTRAILING NULLCOLS\nDATE FORMAT \"YYYY-MM-DD\"\n(\n id,\n name,\n email\n)\n",
20+
"INTO TABLE users\nFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\nDATE FORMAT \"YYYY-MM-DD\"\nTRAILING NULLCOLS\n(\n id,\n name,\n email\n)\n",
2121
$table
2222
);
2323
});

0 commit comments

Comments
 (0)